#!/bin/bash # # chkconfig: 35 90 12 # description: Moji-client Start script # ### BEGIN INIT INFO # Provides: moji-client # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: client service for moji builder # Description: client service for moji builder ### END INIT INFO export pathto="/usr/bin" lockfile="/tmp/moji.lock" # Get function from functions library . /etc/init.d/functions # Start the service Moji-client start() { echo -n "Starting moji-client" daemon "$pathto/moji-client.sh" & ### Create the lock file ### touch /var/lock/subsys/moji-client success $"moji-client started" echo } # Restart the service moji-client stop() { echo -n "Stopping moji-client: " killproc moji killproc mock ### Now, delete the lock file ### rm -f /var/log/subsys/moji-client rm -f /tmp/moji.pid echo } ### main logic ### case "$1" in start) ([ -e $lockfile ] && rm -f $lockfile) || start ;; stop) stop ;; status) status moji-client ;; lock) touch $lockfile ;; unlock) rm -f $lockfile ;; restart|reload|condrestart) stop start ;; *) echo $"Usage: $0 {start|stop|restart|lock|unlock|reload|status}" exit 1 esac exit 0