forked from oZONo32/EHCP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ehcp
executable file
·87 lines (62 loc) · 1.61 KB
/
ehcp
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
#!/bin/bash
# ehcp (Easy Hosting Control Panel) start/stop script
# www.ehcp.net
log="$2"
echo
echo
show_ehcp(){
ps aux | grep ehcpdaemon2 | grep -v grep
ps aux | grep "index.php daemon" | grep -v grep
ps aux | grep "ehcp_daemon.py" | grep -v grep
}
ehcp_start(){
echo "Your OS info:"
cat /etc/*ele*
#Not used
#echo "starting ehcp_daemon.py"
#nohup /etc/init.d/ehcp_daemon.py >> /var/log/ehcp.log 2>&1 &
echo "starting ehcp.."
cd /var/www/new/ehcp
# fix file ownerships, if there are any issues..
find ./ -type d -exec chmod a+rx {} \;
find ./ -type f -exec chmod a+r {} \;
if [ -f path ] ; then # when running inside cron, we need default path. this path variable is filled when installing, in install.sh
export PATH=`cat path`
else
echo "path file NOT FOUND, ehcp may not work correctly in crontab..."
fi
./ehcpdaemon.sh
show_ehcp
if [ "$log" == "log" ] ; then
echo "log gosteriliyor"
tail -f /var/log/ehcp.log
fi
}
ehcp_stop(){
echo "stopping ehcp.."
echo "stopping ehcpdaemon2.sh"
ps aux | grep ehcpdaemon2 | grep -v grep | awk '{print $2}' | xargs kill -9 > /dev/null 2>&1
echo "stopping index.php daemon"
ps aux | grep "index.php daemon" | grep -v grep | awk '{print $2}' | xargs kill -9 > /dev/null 2>&1
echo "stopping ehcp_daemon.py, python background server process"
ps aux | grep ehcp_daemon.py | grep -v grep | awk '{print $2}' | xargs kill > /dev/null 2>&1
show_ehcp
}
case $1 in
start)
ehcp_start
;;
stop)
ehcp_stop
;;
restart)
ehcp_stop
ehcp_start
;;
status)
show_ehcp
;;
*)
echo "Usage: /etc/init.d/ehcp {start|stop|restart|status}"
;;
esac