Skip to content

Commit 286ff80

Browse files
committed
Add an init.d script template
1 parent 47addf9 commit 286ff80

1 file changed

Lines changed: 84 additions & 0 deletions

File tree

templates/uwsgi_service-redhat.erb

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/bin/sh
2+
# This file is managed by puppet class 'uwsgi'
3+
#
4+
# uWSGI Emperor process init.d script
5+
#
6+
# chkconfig: - 85 15
7+
# description: uWSGI Emperor process init.d script
8+
9+
### BEGIN INIT INFO
10+
# Provides: uwsgi
11+
# Required-Start: $local_fs $remote_fs $network
12+
# Required-Stop: $local_fs $remote_fs $network
13+
# Default-Start: 2 3 4 5
14+
# Default-Stop: 0 1 6
15+
# Short-Description: start and stop uwsgi
16+
### END INIT INFO
17+
18+
# Source function library.
19+
. /etc/rc.d/init.d/functions
20+
21+
OPTIONS="--daemonize --die-on-term --ini <%= @config_file %>"
22+
23+
[ -f /etc/sysconfig/uwsgi ] && . /etc/sysconfig/uwsgi
24+
25+
RETVAL=0
26+
prog=uwsgi
27+
lockfile=/var/lock/subsys/$prog
28+
29+
start() {
30+
[ "$EUID" != "0" ] && exit 4
31+
32+
# Start daemons.
33+
echo -n $"Starting $prog: "
34+
daemon $prog $OPTIONS
35+
RETVAL=$?
36+
echo
37+
[ $RETVAL -eq 0 ] && touch $lockfile
38+
return $RETVAL
39+
}
40+
41+
stop() {
42+
[ "$EUID" != "0" ] && exit 4
43+
44+
echo -n $"Shutting down $prog: "
45+
killproc $prog
46+
RETVAL=$?
47+
echo
48+
[ $RETVAL -eq 0 ] && rm -f $lockfile
49+
return $RETVAL
50+
}
51+
52+
reload() {
53+
[ "$EUID" != "0" ] && exit 4
54+
55+
echo -n $"Reloading $prog: "
56+
killproc $prog -HUP
57+
RETVAL=$?
58+
echo
59+
return $RETVAL
60+
}
61+
62+
case "$1" in
63+
start)
64+
start
65+
;;
66+
stop)
67+
stop
68+
;;
69+
status)
70+
status $prog
71+
;;
72+
restart)
73+
stop
74+
start
75+
;;
76+
reload)
77+
reload
78+
;;
79+
*)
80+
echo $"Usage: $0 {start|stop|status|restart|reload}"
81+
exit 2
82+
;;
83+
esac
84+
exit $?

0 commit comments

Comments
 (0)