Mini Shell
#!/usr/bin/bash
### BEGIN INIT INFO
# Provides: lvemanager
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: lvemanager nopanel daemon
# Description: Daemon for access to lvemanager without panel
### END INIT INFO
DAEMON=/usr/bin/lvemanager-service
NAME=lvemanager
DAEMON_OPTS=""
DAEMON_USER=root
PIDFILE=/var/run/$NAME.pid
LOCKFILE=/var/lock/subsys/$NAME
. /etc/init.d/functions
do_start () {
echo -n $"Starting system $NAME daemon: "
if [ -s ${PIDFILE} ]; then
RETVAL=1
echo -n "Already running !" && warning
echo
else
nohup ${DAEMON} >/dev/null 2>&1 &
RETVAL=$?
PID=$!
[ $RETVAL -eq 0 ] && touch ${LOCKFILE} && success || failure
echo
echo $PID > ${PIDFILE}
fi
}
do_stop () {
echo -n $"Stopping system $NAME daemon: "
[ -f /var/lock/subsys/$NAME ] || return 0
echo -n $"Stopping ${NAME} service: "
if [ -z "$PIDFILE" ]; then
killproc $DAEMON
else
killproc -p $PIDFILE $NAME
fi
echo
rm -f $PIDFILE
rm -f $LOCKFILE
}
case "$1" in
start|stop)
do_${1}
;;
restart|reload|force-reload)
do_stop
do_start
;;
status)
status "$NAME" "$DAEMON" && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart|status}"
exit 1
;;
esac
exit 0
Zerion Mini Shell 1.0