4 # Required-Start: $network
5 # Required-Stop: $network
6 # Default-Start: 2 3 4 5
8 # Short-Description: novacoind daemon startup script
9 # Description: novacoind daemon startup script
14 # PATH should only include /usr/* if it runs after the mountnfs.sh script
15 PATH=/sbin:/usr/sbin:/bin:/usr/bin
16 DESC="NovaCoin Daemon"
18 DAEMON=/opt/novacoin/$NAME
19 PIDFILE=/var/run/$NAME.pid
20 SCRIPTNAME=/etc/init.d/$NAME
21 CHUID=novacoin:novacoin
22 DAEMON_ARGS="-daemon -pid=$PIDFILE"
24 # Exit if the package is not installed
25 [ -x "$DAEMON" ] || exit 0
27 # Read configuration variable file if it is present
28 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
30 # Load the VERBOSE setting and other rcS variables
33 # Define LSB log_* functions.
34 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
35 . /lib/lsb/init-functions
38 # Function that starts the daemon/service
43 # 0 if daemon has been started
44 # 1 if daemon was already running
45 # 2 if daemon could not be started
46 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
48 start-stop-daemon --start --quiet --chuid $CHUID --pidfile $PIDFILE --exec $DAEMON -- \
54 # Function that stops the daemon/service
59 # 0 if daemon has been stopped
60 # 1 if daemon was already stopped
61 # 2 if daemon could not be stopped
62 # other if a failure occurred
63 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
65 [ "$RETVAL" = 2 ] && return 2
66 # Wait for children to finish too if this is a daemon that forks
67 # and if the daemon is only ever run from this initscript.
68 # If the above conditions are not satisfied then add some other code
69 # that waits for the process to drop all resources that could be
70 # needed by services started subsequently. A last resort is to
71 # sleep for some time.
72 start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
73 [ "$?" = 2 ] && return 2
74 # Many daemons don't delete their pidfiles when they exit.
80 # Function that sends a SIGHUP to the daemon/service
84 # If the daemon can reload its configuration without
85 # restarting (for example, when it is sent a SIGHUP),
86 # then implement that here.
88 start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
94 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
97 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
98 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
102 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
105 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
106 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
109 #reload|force-reload)
111 # If do_reload() is not implemented then leave this commented out
112 # and leave 'force-reload' as an alias for 'restart'.
114 #log_daemon_msg "Reloading $DESC" "$NAME"
118 restart|force-reload)
120 # If the "reload" option is implemented then remove the
121 # 'force-reload' alias
123 log_daemon_msg "Restarting $DESC" "$NAME"
130 1) log_end_msg 1 ;; # Old process is still running
131 *) log_end_msg 1 ;; # Failed to start
141 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
142 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2