Sophie

Sophie

distrib > Mandriva > 2007.1 > x86_64 > by-pkgid > bfeedc85f3599ac853b3ca4af62f1d11 > files > 3

uptimed-0.3.10-1mdv2007.1.src.rpm

#!/bin/bash
#
# uptimed		This shell script taker care of starting and stopping
#
# chkconfig: 2345 95 05
# description: Uptimed daemon

### BEGIN INIT INFO
# Provides: uptimed
# Default-Start: 2 3 4 5
# Short-Description: Uptimed daemon
# Description: This script launches the uptimed daemon
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

[ -x /usr/sbin/uptimed ] || exit 0

# See how we are called.
case "$1" in

start)
		# Start uptimed
		if [ ! -f /var/spool/uptimed/bootid ] || [ ! -f /var/lock/uptimed_bootid ]; then
			uptimed -b
			touch /var/lock/uptimed_bootid
		fi
		gprintf "Starting uptimed: "
		daemon uptimed
		echo
		touch /var/lock/subsys/uptimed
		;;

stop)
		# Stop uptimed
		gprintf "Stopping uptimed: "
		killproc uptimed
		echo
		rm -f /var/lock/subsys/uptimed
		;;

restart|reload)
		$0 stop
		$0 start
		;;		  

status)
		status uptimed
		;;

createbootid)
		gprintf "There is no need to run \"service uptimed createabootid\" anymore"
		gprintf "as the bootid is created automatically when starting uptimed."
		gprintf "To force recreating of the bootid, remove /var/lock/uptimed_bootid"
		gprintf "and start uptimed again"
		;;

*)
		gprintf "Usage: %s {start|stop|restart|status}\n" "$0"
		exit 1

esac

exit 0