-
Notifications
You must be signed in to change notification settings - Fork 59
/
services.sh
executable file
·73 lines (59 loc) · 1.74 KB
/
services.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
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env bash
if [ $1 = "daemon" ]; then
echo "daemon"
while sleep 1
do
PID=$(ps aux | grep 'daemon:ticker' | grep -v grep | awk '{print $2}')
if [[ -z $PID ]]; then
php artisan daemon:ticker &>/dev/null &
fi
PID=$(ps aux | grep 'daemon:signals' | grep -v grep | awk '{print $2}')
if [[ -z $PID ]]; then
php artisan daemon:signals &>/dev/null &
fi
PID=$(ps aux | grep 'daemon:orders' | grep -v grep | awk '{print $2}')
if [[ -z $PID ]]; then
php artisan daemon:orders &>/dev/null &
fi
# PID=$(ps aux | grep 'ssh -D 1337' | grep -v grep | awk '{print $2}')
# if [[ -z $PID ]]; then
# ssh -D 1337 -f -C -q -N [email protected]
# fi
done
fi
if [ $1 = "status" ]; then
echo "status ..."
PID=$(ps aux | grep 'daemon:ticker' | grep -v grep | awk '{print $2}')
if [[ -z $PID ]]; then
echo "ticker Daemon Stopped"
else
echo "ticker Daemon Running"
fi
PID=$(ps aux | grep 'daemon:signals' | grep -v grep | awk '{print $2}')
if [[ -z $PID ]]; then
echo "Signals Daemon Stopped"
else
echo "Signals Daemon Running"
fi
PID=$(ps aux | grep 'daemon:orders' | grep -v grep | awk '{print $2}')
if [[ -z $PID ]]; then
echo "Orders Daemon Stopped"
else
echo "Orders Daemon Running"
fi
PID=$(ps aux | grep 'ssh -D 1337' | grep -v grep | awk '{print $2}')
if [[ -z $PID ]]; then
echo "Tunnel Daemon Stopped"
else
echo "Tunnel Daemon Running"
fi
fi
if [ $1 = "restart" ]; then
pkill -f "php artisan daemon:"
echo "restarted"
fi
if [ $1 = "stop" ]; then
pkill -f "php artisan daemon:"
pkill -f "services.sh"
echo "stopped"
fi