-
Notifications
You must be signed in to change notification settings - Fork 3
/
initd_UserIdentityBackend
84 lines (69 loc) · 1.32 KB
/
initd_UserIdentityBackend
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
ption: Starts and stops UserIdentityBackend
#
# Source function library.
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
exit 0
fi
# Avoid using root's TMPDIR
unset TMPDIR
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="UserIdentityBackend Server"
NAME=UserIdentityBackend
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
LOCKFILE=/var/lock/subsys/$NAME
export ENV_CONFIG=PROD
do_start()
{
echo "Starting UserIdentityBackend (background)..."
cd /home/UserIdentityBackend
daemon --user=UserIdentityBackend "/home/UserIdentityBackend/start-service.sh" >/dev/null 2>&1 &
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
}
do_stop()
{
echo "Stopping UserIdentityBackend"
pkill -f UserIdentityBackend
rm -f $PIDFILE
return 0
}
do_reload() {
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart)
do_stop
sleep 5
case "$?" in
0|1)
do_start
;;
*)
echo "Failed to restart"
;;
esac
;;
*)
echo $"Usage: $SCRIPTNAME {start|stop|restart}"
exit 1
;;
esac
exit $?