-
Notifications
You must be signed in to change notification settings - Fork 100
/
looker_init
90 lines (68 loc) · 1.6 KB
/
looker_init
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
84
85
86
87
88
89
#!/bin/sh
### BEGIN INIT INFO
# Provides: looker
# Required-Start: $remote_fs $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Looker Web Application
### END INIT INFO
# /etc/init.d/looker: start and stop the Looker Web application
# Set some defaults
LOOKERDIR=/home/looker/looker
LOOKERUSER=looker
if [ ! -x ${LOOKERDIR} ]; then
echo "Looker directory ${LOOKERDIR} does not exist or is not marked exectable."
exit 0
fi
if [ ! -x ${LOOKERDIR}/looker ]; then
echo "Looker startup script ${LOOKERDIR}/looker does not exist or is not marked exectable."
exit 0
fi
umask 022
USER=`whoami`
if [ -f /etc/default/looker ]; then
. /etc/default/looker
fi
. /lib/lsb/init-functions
pidfile=${LOOKERDIR}/.tmp/looker.pid
if [ -r ${pidfile} ]; then
looker_pid=`cat ${pidfile}`
fi
if [ "$USER" != "${LOOKERUSER}" ]; then
if [ "$USER" = "root" ]; then
exec su -l ${LOOKERUSER} -c "$0 $@"
fi
echo "Script must be run from ${LOOKERUSER} or root. You are '${USER}'"
exit 1
fi
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
cd ${LOOKERDIR}
start() {
log_daemon_msg "Starting Looker Web Application" "looker" || true
./looker start
}
stop() {
log_daemon_msg "Stopping Looker Web Application" "looker" || true
./looker stop
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
log_daemon_msg "Restarting Looker Web Application" "looker" || true
./looker restart
;;
status)
./looker status
exit $?
;;
*)
log_action_msg "Usage: /etc/init.d/looker {start|stop|restart|status}" || true
exit 1
esac
exit 0