3 # Required-Start: networking
4 # Required-Stop: networking
5 # Default-Start: 2 3 4 5
7 # Short-Description: remotestorage server
8 # Description: remotestorage-server
11 # Using the lsb functions to perform the operations.
12 . /lib/lsb/init-functions
13 # Process name ( For display )
15 # Daemon name, where is the actual executable
17 # pid file for the daemon
18 PIDFILE=/var/run/krsd.pid
20 # If the daemon is not there, then exit.
21 test -x $DAEMON || exit 5
27 # Checked the PID file exists and check the actual status of process
28 if [ -e $PIDFILE ]; then
29 status_of_proc -p $PIDFILE $DAEMON "$NAME process" && status="0" || status="$?"
30 # If the status is SUCCESS then don't need to start again.
31 if [ $status = "0" ]; then
36 log_daemon_msg "Starting the process" "$NAME"
37 # Start the daemon with the help of start-stop-daemon
38 # Log the message appropriately
39 if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON -- $OPTIONS ; then
47 if [ -e $PIDFILE ]; then
48 status_of_proc -p $PIDFILE $DAEMON "Stoppping the $NAME process" && status="0" || status="$?"
49 if [ "$status" = 0 ]; then
50 start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
54 log_daemon_msg "$NAME process is not running"
60 $0 stop && sleep 2 && $0 start
63 # Check the status of the process.
64 if [ -e $PIDFILE ]; then
65 status_of_proc -p $PIDFILE $DAEMON "$NAME process" && exit 0 || exit $?
67 log_daemon_msg "$NAME Process is not running"
72 # Reload the process. Basically sending some signal to a daemon to reload
74 if [ -e $PIDFILE ]; then
75 start-stop-daemon --stop --signal USR2 --quiet --pidfile $PIDFILE --name $NAME
76 log_success_msg "$NAME process reloaded successfully"
78 log_failure_msg "$PIDFILE does not exists"
82 # For invalid arguments, print the usage message.
83 echo "Usage: $0 {start|stop|restart|reload|status}"