0001-debian-update-init.d-script-for-uwsgi-46568.patch
debian/authentic2-multitenant.init | ||
---|---|---|
1 | 1 |
#!/bin/sh |
2 | 2 |
### BEGIN INIT INFO |
3 | 3 |
# Provides: authentic2-multitenant |
4 |
# Required-Start: $network $local_fs $syslog |
|
5 |
# Required-Stop: $network $local_fs $syslog |
|
6 |
# Should-Start: postgresql
|
|
7 |
# Should-Stop: postgresql
|
|
4 |
# Required-Start: $network $local_fs $remote_fs $syslog
|
|
5 |
# Required-Stop: $network $local_fs $remote_fs $syslog
|
|
6 |
# Should-start: postgresql
|
|
7 |
# Should-stop: postgresql
|
|
8 | 8 |
# Default-Start: 2 3 4 5 |
9 | 9 |
# Default-Stop: 0 1 6 |
10 |
# Short-Description: Authentic2 is a versatile identity provider
|
|
11 |
# Description: Authentic2 is a versatile identity provider
|
|
10 |
# Short-Description: Versatile identity provider
|
|
11 |
# Description: Versatile identity provider
|
|
12 | 12 |
### END INIT INFO |
13 | 13 | |
14 |
# Author: Serghei MIHAI <smihai@entrouvert.com>
|
|
14 |
# Author: Entr'ouvert <info@entrouvert.com>
|
|
15 | 15 | |
16 | 16 |
PATH=/sbin:/usr/sbin:/bin:/usr/bin |
17 | 17 |
DESC=authentic2 |
18 | 18 |
NAME=authentic2-multitenant |
19 |
DAEMON=/usr/bin/gunicorn3
|
|
20 |
PID_DIR=/var/run/$NAME
|
|
21 |
CACHE_DIR=/var/cache/$NAME |
|
19 |
DAEMON=/usr/bin/uwsgi
|
|
20 |
RUN_DIR=/run/$NAME
|
|
21 |
PIDFILE=$RUN_DIR/$NAME.pid |
|
22 | 22 |
LOG_DIR=/var/log/$NAME |
23 |
PIDFILE=$PID_DIR/$NAME.pid |
|
24 | 23 |
SCRIPTNAME=/etc/init.d/$NAME |
25 |
BIND=unix:$PID_DIR/$NAME.sock |
|
26 |
WORKERS=4 |
|
24 |
BIND=unix:$RUN_DIR/$NAME.sock |
|
27 | 25 | |
28 |
export AUTHENTIC2_SETTINGS_FILE=/usr/lib/$NAME/debian_config.py
|
|
26 |
AUTHENTIC2_SETTINGS_FILE=/usr/lib/$NAME/debian_config.py |
|
29 | 27 |
MANAGE_SCRIPT="/usr/bin/$NAME-manage" |
30 | 28 | |
31 | 29 |
USER=authentic-multitenant |
32 | 30 |
GROUP=authentic-multitenant |
33 | 31 | |
34 | 32 |
# Exit if the package is not installed |
35 |
[ -x $DAEMON ] || exit 0
|
|
33 |
[ -x $MANAGE_SCRIPT ] || exit 0
|
|
36 | 34 | |
37 | 35 |
# Read configuration variable file if it is present |
38 | 36 |
[ -r /etc/default/$NAME ] && . /etc/default/$NAME |
39 | 37 | |
40 |
DAEMON_ARGS="--pid $PIDFILE \ |
|
41 |
--user $USER --group $GROUP \ |
|
42 |
--daemon \ |
|
43 |
--access-logfile $LOG_DIR/gunicorn-access.log \ |
|
44 |
--log-file $LOG_DIR/gunicorn-error.log \ |
|
45 |
--bind=$BIND \ |
|
46 |
--workers=$WORKERS \ |
|
47 |
--worker-class=sync \ |
|
48 |
--timeout=60 \ |
|
49 |
authentic2.wsgi:application" |
|
38 |
DAEMON_ARGS=${DAEMON_ARGS:-"--pidfile=$PIDFILE |
|
39 |
--uid $USER --gid $GROUP |
|
40 |
--ini /etc/$NAME/$NAME-uwsgi.ini |
|
41 |
--daemonize /var/log/uwsgi.$NAME.log"} |
|
50 | 42 | |
51 | 43 |
# Load the VERBOSE setting and other rcS variables |
52 | 44 |
. /lib/init/vars.sh |
... | ... | |
55 | 47 |
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. |
56 | 48 |
. /lib/lsb/init-functions |
57 | 49 | |
58 |
# Create pid directory
|
|
59 |
if [ ! -d $PID_DIR ]; then
|
|
60 |
install -d -m 755 -o $USER -g $GROUP $PID_DIR
|
|
50 |
# Create /run directory
|
|
51 |
if [ ! -d $RUN_DIR ]; then
|
|
52 |
install -d -m 755 -o $USER -g $GROUP $RUN_DIR
|
|
61 | 53 |
fi |
62 | 54 | |
63 |
# Create cache directory |
|
64 |
if [ ! -d $CACHE_DIR ]; then |
|
65 |
install -d -m 755 -o $USER -g $GROUP $CACHE_DIR |
|
66 |
fi |
|
67 | ||
68 |
# Function collecting static files |
|
69 |
do_collectstatic() { |
|
70 |
log_action_msg "Collect static files.." |
|
71 |
su $USER -s /bin/sh -p -c "$MANAGE_SCRIPT collectstatic -l --noinput" |
|
72 |
log_action_msg ".. done" |
|
73 |
} |
|
55 |
# environment for wsgi |
|
56 |
export AUTHENTIC2_SETTINGS_FILE |
|
74 | 57 | |
75 | 58 |
# |
76 | 59 |
# Function that starts the daemon/service |
77 | 60 |
# |
78 | 61 |
do_start() |
79 | 62 |
{ |
80 |
# Return |
|
81 |
# 0 if daemon has been started |
|
82 |
# 1 if daemon was already running |
|
83 |
# 2 if daemon could not be started |
|
84 |
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ |
|
85 |
|| return 1 |
|
86 |
start-stop-daemon --start --quiet --exec $DAEMON -- \ |
|
87 |
$DAEMON_ARGS \ |
|
88 |
|| return 2 |
|
63 |
# Return |
|
64 |
# 0 if daemon has been started |
|
65 |
# 1 if daemon was already running |
|
66 |
# 2 if daemon could not be started |
|
67 |
start-stop-daemon --start --quiet --user $USER --exec $DAEMON -- \ |
|
68 |
$DAEMON_ARGS \ |
|
69 |
|| return 2 |
|
89 | 70 |
} |
90 | 71 | |
91 | 72 |
# |
... | ... | |
93 | 74 |
# |
94 | 75 |
do_stop() |
95 | 76 |
{ |
96 |
# Return |
|
97 |
# 0 if daemon has been stopped |
|
98 |
# 1 if daemon was already stopped |
|
99 |
# 2 if daemon could not be stopped |
|
100 |
# other if a failure occurred |
|
101 |
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE |
|
102 |
RETVAL="$?" |
|
103 |
[ "$RETVAL" = 2 ] && return 2 |
|
104 |
# Wait for children to finish too if this is a daemon that forks |
|
105 |
# and if the daemon is only ever run from this initscript. |
|
106 |
# If the above conditions are not satisfied then add some other code |
|
107 |
# that waits for the process to drop all resources that could be |
|
108 |
# needed by services started subsequently. A last resort is to |
|
109 |
# sleep for some time. |
|
110 |
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON |
|
111 |
[ "$?" = 2 ] && return 2 |
|
112 |
# Many daemons don't delete their pidfiles when they exit. |
|
113 |
rm -f $PIDFILE |
|
114 |
return "$RETVAL" |
|
77 |
# Return |
|
78 |
# 0 if daemon has been stopped |
|
79 |
# 1 if daemon was already stopped |
|
80 |
# 2 if daemon could not be stopped |
|
81 |
# other if a failure occurred |
|
82 |
$DAEMON --stop $PIDFILE |
|
83 |
rm -f $PIDFILE |
|
84 |
return 0 # hopefully |
|
115 | 85 |
} |
116 | 86 | |
117 | 87 |
# |
118 | 88 |
# Function that sends a SIGHUP to the daemon/service |
119 | 89 |
# |
120 | 90 |
do_reload() { |
121 |
# |
|
122 |
# If the daemon can reload its configuration without |
|
123 |
# restarting (for example, when it is sent a SIGHUP), |
|
124 |
# then implement that here. |
|
125 |
# |
|
126 |
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name `basename $DAEMON` |
|
127 |
return 0 |
|
91 |
$DAEMON --reload $PIDFILE |
|
92 |
return 0 |
|
128 | 93 |
} |
129 | 94 | |
130 | 95 |
do_migrate() { |
131 |
log_action_msg "Applying new migrations .."
|
|
96 |
log_action_msg "Applying migrations (migrate_schemas).."
|
|
132 | 97 |
su $USER -s /bin/sh -p -c "$MANAGE_SCRIPT migrate_schemas --noinput" |
133 |
log_action_msg ".. done" |
|
98 |
log_action_msg "done" |
|
99 |
} |
|
100 | ||
101 |
do_collectstatic() { |
|
102 |
log_action_msg "Collect static files (collectstatic).." |
|
103 |
su $USER -s /bin/sh -p -c "$MANAGE_SCRIPT collectstatic --noinput" |
|
104 |
log_action_msg "done" |
|
134 | 105 |
} |
135 | 106 | |
136 | 107 |
case "$1" in |
137 | 108 |
start) |
138 | 109 |
log_daemon_msg "Starting $DESC " "$NAME" |
110 |
do_migrate |
|
111 |
do_collectstatic |
|
139 | 112 |
do_start |
140 | 113 |
case "$?" in |
141 |
0|1) log_end_msg 0 ;;
|
|
142 |
2) log_end_msg 1 ;;
|
|
143 |
esac
|
|
114 |
0|1) log_end_msg 0 ;;
|
|
115 |
2) log_end_msg 1 ;;
|
|
116 |
esac
|
|
144 | 117 |
;; |
145 | 118 |
stop) |
146 |
log_daemon_msg "Stopping $DESC" "$NAME"
|
|
147 |
do_stop
|
|
148 |
case "$?" in
|
|
149 |
0|1) log_end_msg 0 ;;
|
|
150 |
2) log_end_msg 1 ;;
|
|
151 |
esac
|
|
152 |
;;
|
|
119 |
log_daemon_msg "Stopping $DESC" "$NAME"
|
|
120 |
do_stop
|
|
121 |
case "$?" in
|
|
122 |
0|1) log_end_msg 0 ;;
|
|
123 |
2) log_end_msg 1 ;;
|
|
124 |
esac
|
|
125 |
;;
|
|
153 | 126 |
status) |
154 |
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? |
|
155 |
;; |
|
156 |
reload) |
|
157 |
log_daemon_msg "Reloading $DESC" "$NAME" |
|
158 |
do_reload |
|
159 |
log_end_msg $? |
|
160 |
;; |
|
161 |
update) |
|
162 |
log_daemon_msg "Updating $DESC" "$NAME" |
|
163 |
do_migrate && do_collectstatic |
|
164 |
log_end_msg $? |
|
165 |
;; |
|
127 |
status_of_proc -p $PIDFILE "$DAEMON" "$NAME" && exit 0 || exit $? |
|
128 |
;; |
|
129 |
reload|force-reload) |
|
130 |
# |
|
131 |
# If do_reload() is not implemented then leave this commented out |
|
132 |
# and leave 'force-reload' as an alias for 'restart'. |
|
133 |
# |
|
134 |
log_daemon_msg "Reloading $DESC" "$NAME" |
|
135 |
do_reload |
|
136 |
log_end_msg $? |
|
137 |
;; |
|
166 | 138 |
restart|force-reload) |
167 |
# |
|
168 |
# If the "reload" option is implemented then remove the |
|
169 |
# 'force-reload' alias |
|
170 |
# |
|
171 |
log_daemon_msg "Restarting $DESC" "$NAME" |
|
172 |
do_stop |
|
173 |
case "$?" in |
|
174 |
0|1) |
|
175 |
do_start |
|
176 |
case "$?" in |
|
177 |
0) log_end_msg 0 ;; |
|
178 |
1) log_end_msg 1 ;; # Old process is still running |
|
179 |
*) log_end_msg 1 ;; # Failed to start |
|
180 |
esac |
|
181 |
;; |
|
182 |
*) |
|
183 |
# Failed to stop |
|
184 |
log_end_msg 1 |
|
185 |
;; |
|
186 |
esac |
|
187 |
;; |
|
139 |
# |
|
140 |
# If the "reload" option is implemented then remove the |
|
141 |
# 'force-reload' alias |
|
142 |
# |
|
143 |
log_daemon_msg "Restarting $DESC" "$NAME" |
|
144 |
do_stop |
|
145 |
case "$?" in |
|
146 |
0|1) |
|
147 |
do_migrate |
|
148 |
do_collectstatic |
|
149 |
do_start |
|
150 |
case "$?" in |
|
151 |
0) log_end_msg 0 ;; |
|
152 |
1) log_end_msg 1 ;; # Old process is still running |
|
153 |
*) log_end_msg 1 ;; # Failed to start |
|
154 |
esac |
|
155 |
;; |
|
156 |
*) |
|
157 |
# Failed to stop |
|
158 |
log_end_msg 1 |
|
159 |
;; |
|
160 |
esac |
|
161 |
;; |
|
188 | 162 |
*) |
189 |
echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|update}" >&2
|
|
190 |
exit 3
|
|
191 |
;;
|
|
163 |
echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
|
|
164 |
exit 3
|
|
165 |
;;
|
|
192 | 166 |
esac |
193 |
debian/authentic2.init | ||
---|---|---|
1 | 1 |
#!/bin/sh |
2 | 2 |
### BEGIN INIT INFO |
3 | 3 |
# Provides: authentic2 |
4 |
# Required-Start: $network $local_fs $syslog |
|
5 |
# Required-Stop: $network $local_fs $syslog |
|
6 |
# Should-Start: postgresql
|
|
7 |
# Should-Stop: postgresql
|
|
4 |
# Required-Start: $network $local_fs $remote_fs $syslog
|
|
5 |
# Required-Stop: $network $local_fs $remote_fs $syslog
|
|
6 |
# Should-start: postgresql
|
|
7 |
# Should-stop: postgresql
|
|
8 | 8 |
# Default-Start: 2 3 4 5 |
9 | 9 |
# Default-Stop: 0 1 6 |
10 |
# Short-Description: Authentic2 is a versatile identity provider
|
|
11 |
# Description: Authentic2 is a versatile identity provider
|
|
10 |
# Short-Description: Versatile identity provider
|
|
11 |
# Description: Versatile identity provider
|
|
12 | 12 |
### END INIT INFO |
13 | 13 | |
14 |
# Author: Jérôme Schneider <jschneider@entrouvert.com>
|
|
14 |
# Author: Entr'ouvert <info@entrouvert.com>
|
|
15 | 15 | |
16 | 16 |
PATH=/sbin:/usr/sbin:/bin:/usr/bin |
17 | 17 |
DESC=authentic2 |
18 | 18 |
NAME=authentic2 |
19 |
DAEMON=/usr/bin/gunicorn3
|
|
20 |
PID_DIR=/var/run/$NAME
|
|
21 |
CACHE_DIR=/var/cache/$NAME |
|
19 |
DAEMON=/usr/bin/uwsgi
|
|
20 |
RUN_DIR=/run/$NAME
|
|
21 |
PIDFILE=$RUN_DIR/$NAME.pid |
|
22 | 22 |
LOG_DIR=/var/log/$NAME |
23 |
PIDFILE=$PID_DIR/$NAME.pid |
|
24 | 23 |
SCRIPTNAME=/etc/init.d/$NAME |
25 |
BIND=unix:$PID_DIR/$NAME.sock |
|
26 |
WORKERS=4 |
|
24 |
BIND=unix:$RUN_DIR/$NAME.sock |
|
27 | 25 | |
28 |
export AUTHENTIC2_SETTINGS_FILE=/usr/share/$NAME/debian_config.py
|
|
26 |
AUTHENTIC2_SETTINGS_FILE=/usr/lib/$NAME/debian_config.py
|
|
29 | 27 |
MANAGE_SCRIPT=/usr/bin/$NAME-manage |
30 | 28 | |
31 | 29 |
USER=authentic2 |
32 | 30 |
GROUP=authentic2 |
33 | 31 | |
34 | 32 |
# Exit if the package is not installed |
35 |
[ -x $DAEMON ] || exit 0
|
|
33 |
[ -x $MANAGE_SCRIPT ] || exit 0
|
|
36 | 34 | |
37 | 35 |
# Read configuration variable file if it is present |
38 | 36 |
[ -r /etc/default/$NAME ] && . /etc/default/$NAME |
39 | 37 | |
40 |
DAEMON_ARGS="--pid $PIDFILE \ |
|
41 |
--user $USER --group $GROUP \ |
|
42 |
--daemon \ |
|
43 |
--access-logfile $LOG_DIR/gunicorn-access.log \ |
|
44 |
--log-file $LOG_DIR/gunicorn-error.log \ |
|
45 |
--bind=$BIND \ |
|
46 |
--workers=$WORKERS \ |
|
47 |
--worker-class=sync \ |
|
48 |
--timeout=60 \ |
|
49 |
authentic2.wsgi:application" |
|
38 |
DAEMON_ARGS=${DAEMON_ARGS:-"--pidfile=$PIDFILE |
|
39 |
--uid $USER --gid $GROUP |
|
40 |
--ini /etc/$NAME/$NAME-uwsgi.ini |
|
41 |
--daemonize /var/log/uwsgi.$NAME.log"} |
|
50 | 42 | |
51 | 43 |
# Load the VERBOSE setting and other rcS variables |
52 | 44 |
. /lib/init/vars.sh |
... | ... | |
55 | 47 |
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. |
56 | 48 |
. /lib/lsb/init-functions |
57 | 49 | |
58 |
# Create pid directory
|
|
59 |
if [ ! -d $PID_DIR ]; then
|
|
60 |
install -d -m 755 -o $USER -g $GROUP $PID_DIR
|
|
50 |
# Create /run directory
|
|
51 |
if [ ! -d $RUN_DIR ]; then
|
|
52 |
install -d -m 755 -o $USER -g $GROUP $RUN_DIR
|
|
61 | 53 |
fi |
62 | 54 | |
63 |
# Create cache directory |
|
64 |
if [ ! -d $CACHE_DIR ]; then |
|
65 |
install -d -m 755 -o $USER -g $GROUP $CACHE_DIR |
|
66 |
fi |
|
55 |
# environment for wsgi |
|
56 |
export AUTHENTIC2_SETTINGS_FILE |
|
67 | 57 | |
68 | 58 |
# Load old authentic configuration |
69 | 59 |
if [ -f /etc/authentic2/db.conf ]; then |
... | ... | |
73 | 63 |
. /etc/authentic2/authentic.conf |
74 | 64 |
fi |
75 | 65 | |
76 |
# Function collecting static files |
|
77 |
do_collectstatic() { |
|
78 |
log_action_msg "Collect static files.." |
|
79 |
su $USER -s /bin/sh -p -c "$MANAGE_SCRIPT collectstatic -l --noinput" |
|
80 |
log_action_msg ".. done" |
|
81 |
} |
|
82 | ||
83 | 66 |
# |
84 | 67 |
# Function that starts the daemon/service |
85 | 68 |
# |
86 | 69 |
do_start() |
87 | 70 |
{ |
88 |
# Return |
|
89 |
# 0 if daemon has been started |
|
90 |
# 1 if daemon was already running |
|
91 |
# 2 if daemon could not be started |
|
92 |
export AUTHENTIC2_SETTINGS_FILE |
|
93 |
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ |
|
94 |
|| return 1 |
|
95 |
start-stop-daemon --start --quiet --exec $DAEMON -- \ |
|
96 |
$DAEMON_ARGS \ |
|
97 |
|| return 2 |
|
71 |
# Return |
|
72 |
# 0 if daemon has been started |
|
73 |
# 1 if daemon was already running |
|
74 |
# 2 if daemon could not be started |
|
75 |
start-stop-daemon --start --quiet --user $USER --exec $DAEMON -- \ |
|
76 |
$DAEMON_ARGS \ |
|
77 |
|| return 2 |
|
98 | 78 |
} |
99 | 79 | |
100 | 80 |
# |
... | ... | |
102 | 82 |
# |
103 | 83 |
do_stop() |
104 | 84 |
{ |
105 |
# Return |
|
106 |
# 0 if daemon has been stopped |
|
107 |
# 1 if daemon was already stopped |
|
108 |
# 2 if daemon could not be stopped |
|
109 |
# other if a failure occurred |
|
110 |
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE |
|
111 |
RETVAL="$?" |
|
112 |
[ "$RETVAL" = 2 ] && return 2 |
|
113 |
# Wait for children to finish too if this is a daemon that forks |
|
114 |
# and if the daemon is only ever run from this initscript. |
|
115 |
# If the above conditions are not satisfied then add some other code |
|
116 |
# that waits for the process to drop all resources that could be |
|
117 |
# needed by services started subsequently. A last resort is to |
|
118 |
# sleep for some time. |
|
119 |
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON |
|
120 |
[ "$?" = 2 ] && return 2 |
|
121 |
# Many daemons don't delete their pidfiles when they exit. |
|
122 |
rm -f $PIDFILE |
|
123 |
return "$RETVAL" |
|
85 |
# Return |
|
86 |
# 0 if daemon has been stopped |
|
87 |
# 1 if daemon was already stopped |
|
88 |
# 2 if daemon could not be stopped |
|
89 |
# other if a failure occurred |
|
90 |
$DAEMON --stop $PIDFILE |
|
91 |
rm -f $PIDFILE |
|
92 |
return 0 # hopefully |
|
124 | 93 |
} |
125 | 94 | |
126 | 95 |
# |
127 | 96 |
# Function that sends a SIGHUP to the daemon/service |
128 | 97 |
# |
129 | 98 |
do_reload() { |
130 |
# |
|
131 |
# If the daemon can reload its configuration without |
|
132 |
# restarting (for example, when it is sent a SIGHUP), |
|
133 |
# then implement that here. |
|
134 |
# |
|
135 |
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name `basename $DAEMON` |
|
136 |
return 0 |
|
99 |
$DAEMON --reload $PIDFILE |
|
100 |
return 0 |
|
137 | 101 |
} |
138 | 102 | |
139 | 103 |
do_migrate() { |
140 |
log_action_msg "Applying new migrations .." |
|
141 |
su $USER -p -c "$MANAGE_SCRIPT migrate --noinput" |
|
142 |
log_action_msg ".. done" |
|
104 |
log_action_msg "Applying migrations.." |
|
105 |
su $USER -s /bin/sh -p -c "$MANAGE_SCRIPT migrate --noinput" |
|
106 |
log_action_msg "done" |
|
107 |
} |
|
108 | ||
109 |
do_collectstatic() { |
|
110 |
log_action_msg "Collect static files (collectstatic).." |
|
111 |
su $USER -s /bin/sh -p -c "$MANAGE_SCRIPT collectstatic --noinput" |
|
112 |
log_action_msg "done" |
|
143 | 113 |
} |
144 | 114 | |
145 | 115 |
case "$1" in |
... | ... | |
149 | 119 |
do_collectstatic |
150 | 120 |
do_start |
151 | 121 |
case "$?" in |
152 |
0|1) log_end_msg 0 ;;
|
|
153 |
2) log_end_msg 1 ;;
|
|
154 |
esac
|
|
122 |
0|1) log_end_msg 0 ;;
|
|
123 |
2) log_end_msg 1 ;;
|
|
124 |
esac
|
|
155 | 125 |
;; |
156 | 126 |
stop) |
157 |
log_daemon_msg "Stopping $DESC" "$NAME"
|
|
158 |
do_stop
|
|
159 |
case "$?" in
|
|
160 |
0|1) log_end_msg 0 ;;
|
|
161 |
2) log_end_msg 1 ;;
|
|
162 |
esac
|
|
163 |
;;
|
|
127 |
log_daemon_msg "Stopping $DESC" "$NAME"
|
|
128 |
do_stop
|
|
129 |
case "$?" in
|
|
130 |
0|1) log_end_msg 0 ;;
|
|
131 |
2) log_end_msg 1 ;;
|
|
132 |
esac
|
|
133 |
;;
|
|
164 | 134 |
status) |
165 |
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? |
|
166 |
;; |
|
167 |
reload) |
|
168 |
log_daemon_msg "Reloading $DESC" "$NAME" |
|
169 |
do_reload |
|
170 |
log_end_msg $? |
|
171 |
;; |
|
172 |
update) |
|
173 |
log_daemon_msg "Updating $DESC" "$NAME" |
|
174 |
do_migrate && do_collectstatic |
|
175 |
log_end_msg $? |
|
176 |
;; |
|
135 |
status_of_proc -p $PIDFILE "$DAEMON" "$NAME" && exit 0 || exit $? |
|
136 |
;; |
|
137 |
reload|force-reload) |
|
138 |
# |
|
139 |
# If do_reload() is not implemented then leave this commented out |
|
140 |
# and leave 'force-reload' as an alias for 'restart'. |
|
141 |
# |
|
142 |
log_daemon_msg "Reloading $DESC" "$NAME" |
|
143 |
do_reload |
|
144 |
log_end_msg $? |
|
145 |
;; |
|
177 | 146 |
restart|force-reload) |
178 |
log_daemon_msg "Restarting $DESC" "$NAME" |
|
179 |
do_stop |
|
180 |
case "$?" in |
|
181 |
0|1) |
|
182 |
do_start |
|
183 |
case "$?" in |
|
184 |
0) log_end_msg 0 ;; |
|
185 |
1) log_end_msg 1 ;; # Old process is still running |
|
186 |
*) log_end_msg 1 ;; # Failed to start |
|
187 |
esac |
|
188 |
;; |
|
189 |
*) |
|
190 |
# Failed to stop |
|
191 |
log_end_msg 1 |
|
192 |
;; |
|
193 |
esac |
|
194 |
;; |
|
147 |
# |
|
148 |
# If the "reload" option is implemented then remove the |
|
149 |
# 'force-reload' alias |
|
150 |
# |
|
151 |
log_daemon_msg "Restarting $DESC" "$NAME" |
|
152 |
do_stop |
|
153 |
case "$?" in |
|
154 |
0|1) |
|
155 |
do_migrate |
|
156 |
do_collectstatic |
|
157 |
do_start |
|
158 |
case "$?" in |
|
159 |
0) log_end_msg 0 ;; |
|
160 |
1) log_end_msg 1 ;; # Old process is still running |
|
161 |
*) log_end_msg 1 ;; # Failed to start |
|
162 |
esac |
|
163 |
;; |
|
164 |
*) |
|
165 |
# Failed to stop |
|
166 |
log_end_msg 1 |
|
167 |
;; |
|
168 |
esac |
|
169 |
;; |
|
195 | 170 |
*) |
196 |
echo "Usage: $SCRIPTNAME {start|stop|status|restart|update|reload}" >&2
|
|
197 |
exit 3
|
|
198 |
;;
|
|
171 |
echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
|
|
172 |
exit 3
|
|
173 |
;;
|
|
199 | 174 |
esac |
200 | ||
201 |
- |