#!/bin/sh # # ivman This script start ivman deamon # # chkconfig: 345 26 59 # description: This script start and stop the ivman deamon # processname: ivman # pid /var/run/ivman.pid # config: /etc/ivman/* # ### BEGIN INIT INFO # Provides: ivman # Required-Start: haldaemon # Required-Stop: haldaemon # Default-Start: 3 4 5 # Short-Description: ivman daemon to handle HAL events # Description: Ivman is a generic handler for HAL events. # It can be used to automount, run arbitrary commands when # events or conditions occur or properties are modified on your hardware # (e.g., run a command when you close your laptop's lid, run a command when # a particular device is attached or a particular CD is inserted, etc). ### END INIT INFO . /etc/init.d/functions processname=ivman servicename=ivman # Sanity checks. [ -x /usr/bin/ivman ] || exit 0 RETVAL=0 function ivman_start() { gprintf "Starting ivman daemon: " daemon --check $servicename $processname RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename && echo `/sbin/pidof $processname` > /var/run/ivman.pid } function ivman_stop() { gprintf "Stopping ivman daemon: " killproc $servicename -TERM RETVAL=$? echo if [ $RETVAL -eq 0 ]; then rm -f /var/lock/subsys/$servicename rm -f /var/run/ivman.pid fi } function ivman_status() { status $processname RETVAL=$? } case "$1" in start) ivman_start ;; stop) ivman_stop ;; restart|reload) ivman_stop sleep 1 ivman_start ;; condrestart) if [ -f /var/lock/subsys/$servicename ]; then ivman_stop sleep 1 ivman_start fi ;; status) ivman_status ;; *) gprintf "Usage: %s:\n" "$(basename $0) {start|stop|restart|status|condrestart}}" exit 1 ;; esac exit 0