forked from zonyl/pytomation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyto
executable file
·57 lines (50 loc) · 1.18 KB
/
pyto
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
#!/bin/sh
### BEGIN INIT INFO
# Provides: pytomation
# Required-Start: networking
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts Pytomation server
# Description:
### END INIT INFO
# Pytomation automatically generates a PID file here:
PID=/var/run/pytomation.pid
# Use this command to start the proxy
# this just calls another script that does the real work
DAEMON=/usr/bin/pytomation.sh
# Start pytomation
start()
{
echo "Starting Pytomation"
start-stop-daemon --start --background --quiet --exec $DAEMON && success=1
# --chuid doesn't work with scripts
# start-stop-daemon --start --background --quiet --chuid pyto --exec $DAEMON && success=1
echo ""
}
# Stop pytomation
stop()
{
echo "Stopping Pytomation"
start-stop-daemon --stop --quiet --pidfile $PID && success=1
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
echo "Pytomation stopped..."
sleep 5
start
echo "Pytomation started..."
;;
*) # Display a usage option.
echo "Usage: /etc/init.d/pytomation {start|stop|restart}"
exit 1
;;
esac
exit 0