-
Notifications
You must be signed in to change notification settings - Fork 0
/
hhvm.sh
executable file
·62 lines (51 loc) · 1.01 KB
/
hhvm.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
#!/bin/bash
function startHHVM {
echo "Looking if hhvmd is running"
if [ -e /docker/config/hhvm.pid ] ; then
pid=$(cat /docker/config/hhvm.pid)
echo "hhvm is running already. pid = $pid"
else
echo "Starting hhvm."
hhvm -m server -p 80 -c /docker/config/hhvm.hdf &
echo "Daemon Started."
fi
}
function stopHHVM {
echo "Looking if hhvmd is running"
if [ -e /docker/config/hhvm.pid ] ; then
pid=$(cat /docker/config/hhvm.pid)
echo "Killing hhvm with pid $pid"
kill -SIGTERM ${pid}
rm /docker/config/hhvm.pid -f
else
echo "hhvm is not running."
fi
}
case "$1" in
start)
startHHVM
echo "[Ok]"
;;
stop)
stopHHVM
echo "[OK]"
;;
update)
echo "Running hhvmd update"
cd /docker/config/
git pull
echo "hhvmd updated, restarting hhvm daemon now"
stopHHVM
startHHVM
echo "[OK]"
;;
restart)
stopHHVM
startHHVM
echo "[OK]"
;;
*)
echo "Usage: hhvmd {start|stop|restart|update}"
exit 1
esac
exit 0