forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhestia
More file actions
96 lines (80 loc) · 2.18 KB
/
hestia
File metadata and controls
96 lines (80 loc) · 2.18 KB
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
90
91
92
93
94
95
96
#!/bin/sh
### BEGIN INIT INFO
# Provides: hestia
# internal nginx
# internal php-fpm
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the hestia control panel
# Description: starts nginx and php-fpm using start-stop-daemon
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NGINX_DAEMON=/usr/local/hestia/nginx/sbin/hestia-nginx
NGINX_NAME=hestia-nginx
NGINX_DESC=hestia-nginx
NGINX_PID=/run/hestia-nginx.pid
NGINX_CONF=/usr/local/hestia/nginx/conf/nginx.conf
PHP_DAEMON=/usr/local/hestia/php/sbin/hestia-php
PHP_NAME=hestia-php
PHP_DESC=hestia-php
PHP_PID=/run/hestia-php.pid
PHP_CONF=/usr/local/hestia/php/etc/php-fpm.conf
set -e
. /lib/lsb/init-functions
. /etc/profile.d/hestia.sh
start_nginx() {
start-stop-daemon --start --quiet --pidfile $NGINX_PID \
--retry 5 --exec $NGINX_DAEMON --oknodo
}
start_php() {
start-stop-daemon --start --quiet --pidfile $PHP_PID \
--retry 5 --exec $PHP_DAEMON --oknodo
}
stop_nginx() {
start-stop-daemon --stop --quiet --pidfile $NGINX_PID \
--retry 5 --oknodo --exec $NGINX_DAEMON
}
stop_php() {
start-stop-daemon --stop --quiet --pidfile $PHP_PID \
--retry 5 --oknodo --exec $PHP_DAEMON
}
case "$1" in
start)
log_daemon_msg "Starting $NGINX_DESC" "$NGINX_NAME"
start_nginx
log_end_msg $?
log_daemon_msg "Starting $PHP_DESC" "$PHP_NAME"
start_php
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $NGINX_DESC" "$NGINX_NAME"
stop_nginx
log_end_msg $?
log_daemon_msg "Stopping $PHP_DESC" "$PHP_NAME"
stop_php
log_end_msg $?
;;
restart | force-reload | reload | configtest | testconfig)
log_daemon_msg "Restarting $NGINX_DESC" "$NGINX_NAME"
stop_nginx
stop_php
sleep 1
start_nginx
log_end_msg $?
log_daemon_msg "Restarting $PHP_DESC" "$PHP_NAME"
start_php
log_end_msg $?
;;
status)
status_of_proc -p $NGINX_PID "$NGINX_DAEMON" hestia-nginx
status_of_proc -p $PHP_PID "$PHP_DAEMON" hestia-php
;;
*)
echo "Usage: hestia {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0