-
Notifications
You must be signed in to change notification settings - Fork 3
/
init_script_postgres
56 lines (48 loc) · 1.51 KB
/
init_script_postgres
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
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: PtokaX
# Required-Start: $local_fs $remote_fs $network $syslog postgresql
# Required-Stop: $local_fs $remote_fs $network $syslog postgresql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start/stop/restart PtokaX
### END INIT INFO
# Get LSB functions
. /lib/lsb/init-functions
. /etc/default/rcS
PTOKAX_USER=ptokax
PTOKAX_GROUP=ptokax
PTOKAX_BIN=/usr/local/bin/PtokaX
PTOKAX_PATH=/home/$PTOKAX_USER/
PTOKAX_PID=$PTOKAX_PATHPtokaX.pid
# Check that the package is still installed
[ -x $PTOKAX_BIN ] || exit 0;
case "$1" in
start)
log_begin_msg "Starting PtokaX...\n"
if start-stop-daemon --start \
--chuid $PTOKAX_USER:$PTOKAX_GROUP --pidfile $PTOKAX_PID\
--exec $PTOKAX_BIN \
-- -d -c $PTOKAX_PATH -p $PTOKAX_PID; then
log_end_msg 0
else
log_end_msg $?
fi
;;
stop)
log_begin_msg "Stopping PtokaX...\n"
if start-stop-daemon --stop --pidfile $PTOKAX_PID --exec $PTOKAX_BIN; then
log_end_msg 0
else
log_end_msg $?
fi
;;
restart)
"$0" stop && "$0" start
;;
*)
e cho "Usage: /etc/init.d/ptokax {start|stop|restart}"
exit 1
;;
esac
exit 0