This repository was archived by the owner on Aug 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkether_npm.sh
More file actions
executable file
·77 lines (66 loc) · 1.93 KB
/
kether_npm.sh
File metadata and controls
executable file
·77 lines (66 loc) · 1.93 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
#!/bin/sh
# Do not change this path
PATH=/bin:/usr/bin:/sbin:/usr/sbin
# The path to the website, only change this if you have a different installation path than in the guide.
DIR=/home/rocky/Kether.pl-website-server
DAEMON="npm run"
# Change all Parameters to your needs.
# The current settings will start both the npm 'run start' and 'run server' instances
ST=start
SV=server
NAME=Kether_npm_$ST
NAME2=Kether_npm_$SV
DESC="Kether Website $DAEMON $ST/$SV"
###########################################
# #
# DON'T TOUCH THESE #
# #
###########################################
case "$1" in
start)
echo "Starting $DESC: $NAME / $NAME2"
if [ -e $DIR ]; then
cd $DIR
screen -d -m -S $NAME $DAEMON $ST
screen -d -m -L -S $NAME2 $DAEMON $SV
else
echo "No such directory: $DIR!"
fi
;;
stop)
if screen -ls |grep -e $NAME -e $NAME2; then
echo -n "Stopping $DESC: $NAME / $NAME2"
kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'`
kill `screen -ls |grep $NAME2 |awk -F . '{print $1}'|awk '{print $1}'`
echo " ... done."
else
echo "Couldn't find a running $DESC"
fi
;;
restart)
if screen -ls |grep -e $NAME -e $NAME2; then
echo -n "Stopping $DESC: $NAME / $NAME2"
kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'`
kill `screen -ls |grep $NAME2 |awk -F . '{print $1}'|awk '{print $1}'`
echo " ... done."
else
echo "Couldn't find a running $DESC"
fi
echo -n "Starting $DESC: $NAME / $NAME2"
cd $DIR
screen -d -m -S $NAME $DAEMON $ST
screen -d -m -L -S $NAME2 $DAEMON $SV
echo " ... done."
;;
status)
# Check whether there's a "srcds" process
ps aux | grep -v grep | grep Kether_npm_ > /dev/null
CHECK=$?
[ $CHECK -eq 0 ] && echo "NPM is UP" || echo "NPM is DOWN"
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
exit 0