forked from lamyj/dopamine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdopamine_init_redhat.sh
73 lines (65 loc) · 1.47 KB
/
dopamine_init_redhat.sh
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
#!/bin/bash
#
# chkconfig: - 85 15
# description: Dopamine is a document-oriented PACS
# processname: dopamine
# config: /etc/dopamine/dopamine_conf.ini
# pidfile: /var/run/dopamine/dopamine.pid
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
dopamine="/usr/local/bin/dopamine"
prog=$(basename $dopamine)
lockfile=/var/lock/subsys/${prog}
pidfile=/var/run/dopamine/dopamine.pid
dopamine_options=${dopamine_options:-""}
start() {
echo -n "Starting ${prog}: "
if [ -s ${pidfile} ]
then
retval=1
echo -n "Already running !" && warning
echo
else
nohup ${dopamine} ${dopamine_options} > /var/log/dopamine.log &
retval=$?
pid=$!
[ ${retval} -eq 0 ] && touch ${lockfile} && success || failure
echo ${pid} > ${pidfile}
fi
return $retval
}
stop() {
echo -n "Shutting down ${prog}: "
killproc -p ${pidfile} ${prog}
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status ${prog}
;;
restart)
stop
start
;;
reload)
stop
start
;;
condrestart)
[ -f ${lockfile} ] && restart || :
;;
esac
exit $?