summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Bartelt <tom@ataullah.(none)>2013-07-23 06:32:42 -0400
committerTom Bartelt <tom@ataullah.(none)>2013-07-23 06:32:42 -0400
commitf1ea6024cf0566cda719968c7ad6cf3342e10cb3 (patch)
treed3d0a6ecd2f0d179f8c3e0fc5781a42136562d17
parent9f6f3117bb1b3131038dd5a890063b7625858177 (diff)
renamed init script
-rwxr-xr-xother/bootstrap_serverdaemon/DHT_bootstrap_daemon.sh111
-rw-r--r--other/bootstrap_serverdaemon/initscript.sh109
2 files changed, 111 insertions, 109 deletions
diff --git a/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.sh b/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.sh
new file mode 100755
index 00000000..d5e9d9c0
--- /dev/null
+++ b/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.sh
@@ -0,0 +1,111 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides: DHT_bootstrap_daemon
4# Required-Start: $remote_fs $syslog
5# Required-Stop: $remote_fs $syslog
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: Start the Tox bootstrapping server
9# Description: Use this piece of junk to start the Tox
10# bootstrap server.
11### END INIT INFO
12
13# PATH should only include /usr/* if it runs after the mountnfs.sh script
14PATH=/sbin:/usr/sbin:/bin:/usr/bin
15DESC="ProjectTox bootstrap server daemon"
16NAME=DHT_bootstrap_daemon
17CFG=/home/$USER/server.cfg
18DAEMON=/home/$USER/$NAME
19DAEMON_ARGS="$CFG"
20PIDFILE=/home/$USER/.$NAME.pid
21SCRIPTNAME=/etc/init.d/$NAME
22
23
24VERBOSE=yes
25# Exit if the package is not installed
26[ -x "$DAEMON" ] || exit 0
27
28# Read configuration variable file if it is present
29#[ -r /etc/default/$NAME ] && . /etc/default/$NAME
30
31# Load the VERBOSE setting and other rcS variables
32. /lib/init/vars.sh
33
34# Define LSB log_* functions.
35# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
36# and status_of_proc is working.
37. /lib/lsb/init-functions
38
39#
40# Function that starts the daemon/service
41#
42do_start()
43{
44 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
45 || return 1
46 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
47 $DAEMON_ARGS \
48 || return 2
49 sleep 1
50}
51
52#
53# Function that stops the daemon/service
54#
55do_stop()
56{
57 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --exec $DAEMON
58 RETVAL="$?"
59 [ "$RETVAL" = 2 ] && return 2
60
61 start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
62 [ "$?" = 2 ] && return 2
63 # Many daemons don't delete their pidfiles when they exit.
64 rm -f $PIDFILE
65 return "$RETVAL"
66}
67
68case "$1" in
69 start)
70 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
71 do_start
72 case "$?" in
73 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
74 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
75 esac
76 ;;
77 stop)
78 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
79 do_stop
80 case "$?" in
81 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
82 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
83 esac
84 ;;
85 status)
86 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
87 ;;
88
89 restart) #|force-reload)
90 log_daemon_msg "Restarting $DESC" "$NAME"
91 do_stop
92 case "$?" in
93 0|1)
94 do_start
95 case "$?" in
96 0) log_end_msg 0 ;;
97 1) log_end_msg 1 ;; # Old process is still running
98 *) log_end_msg 1 ;; # Failed to start
99 esac
100 ;;
101 *)
102 # Failed to stop
103 log_end_msg 1
104 ;;
105 esac
106 ;;
107 *)
108 echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
109 exit 3
110 ;;
111esac
diff --git a/other/bootstrap_serverdaemon/initscript.sh b/other/bootstrap_serverdaemon/initscript.sh
deleted file mode 100644
index aa4b3e77..00000000
--- a/other/bootstrap_serverdaemon/initscript.sh
+++ /dev/null
@@ -1,109 +0,0 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides: bootstrap_server
4# Required-Start: $remote_fs $syslog
5# Required-Stop: $remote_fs $syslog
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: Start the Tox bootstrapping server
9# Description: Use this piece of junk to start the Tox
10# bootstrap server.
11### END INIT INFO
12
13# PATH should only include /usr/* if it runs after the mountnfs.sh script
14PATH=/sbin:/usr/sbin:/bin:/usr/bin
15DESC="ProjectTox bootstrap server daemon"
16NAME=bootstrap_server
17DAEMON=/home/$USER/$NAME
18DAEMON_ARGS=""
19PIDFILE=/home/$USER/.$NAME.pid
20SCRIPTNAME=/etc/init.d/$NAME
21
22# Exit if the package is not installed
23[ -x "$DAEMON" ] || exit 0
24
25# Read configuration variable file if it is present
26[ -r /etc/default/$NAME ] && . /etc/default/$NAME
27
28# Load the VERBOSE setting and other rcS variables
29. /lib/init/vars.sh
30
31# Define LSB log_* functions.
32# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
33# and status_of_proc is working.
34. /lib/lsb/init-functions
35
36#
37# Function that starts the daemon/service
38#
39do_start()
40{
41 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
42 || return 1
43 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
44 $DAEMON_ARGS \
45 || return 2
46 sleep 1
47}
48
49#
50# Function that stops the daemon/service
51#
52do_stop()
53{
54 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --exec $DAEMON
55 RETVAL="$?"
56 [ "$RETVAL" = 2 ] && return 2
57
58 start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
59 [ "$?" = 2 ] && return 2
60 # Many daemons don't delete their pidfiles when they exit.
61 rm -f $PIDFILE
62 return "$RETVAL"
63}
64
65case "$1" in
66 start)
67 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
68 do_start
69 case "$?" in
70 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
71 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
72 esac
73 ;;
74 stop)
75 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
76 do_stop
77 case "$?" in
78 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
79 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
80 esac
81 ;;
82 status)
83 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
84 ;;
85
86 restart) #|force-reload)
87 log_daemon_msg "Restarting $DESC" "$NAME"
88 do_stop
89 case "$?" in
90 0|1)
91 do_start
92 case "$?" in
93 0) log_end_msg 0 ;;
94 1) log_end_msg 1 ;; # Old process is still running
95 *) log_end_msg 1 ;; # Failed to start
96 esac
97 ;;
98 *)
99 # Failed to stop
100 log_end_msg 1
101 ;;
102 esac
103 ;;
104 *)
105 echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
106 exit 3
107 ;;
108esac
109