-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofession.init
More file actions
executable file
·83 lines (76 loc) · 1.84 KB
/
profession.init
File metadata and controls
executable file
·83 lines (76 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh
# profession <summary>
#
# chkconfig: 2345 80 20
# description: Starts and stops profession webapp
### BEGIN INIT INFO
# Provides: profession
# Required-Start: $network $named
# Required-Stop: $network $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: This service manages the profession daemon
# Description: This is a simple python flask webapp to store profession information
### END INIT INFO
# /etc/init.d/profession -- startup script for profession webapp
if [ -f /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions
elif [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
else
echo "Init functions not found"
exit 3
fi
PIDFILE="/var/run/profession.pid"
PROFESSION_DIR="/root/narvar/profession/"
APPLICATION_NAME="Profession"
start() {
echo -n "Starting ${APPLICATION_NAME} Daemon: "
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
echo ${APPLICATION_NAME} already running: $PID
exit 1;
else
cd $PROFESSION_DIR
PID=`python wsgi/profession.py >profession.log 2>&1 & echo $! > $PIDFILE`
echo `cat $PIDFILE`
fi
}
stop() {
echo "Stopping ${APPLICATION_NAME}:"
if [ `ps -ef | grep profession.py | grep -v grep > /dev/null 2>&1; echo $?` -eq 0 ]; then
echo -n " Shutting down ${APPLICATION_NAME} Daemon: `cat $PIDFILE`"
echo
kill `ps -ef | grep profession.py | grep -v grep | awk '{ print $2 }'`
echo
rm -f /var/lock/subsys/profession
rm -f ${PIDFILE}
return 0
else
echo -n " ${APPLICATION_NAME} not running, removing lock and PID file."
echo
rm -f /var/lock/subsys/profession
rm -f ${PIDFILE}
return 0
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status profession
;;
restart)
stop
start
;;
*)
echo "Usage: {start|stop|status|restart}"
exit 1
;;
esac
exit $?