-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprintd
58 lines (46 loc) · 926 Bytes
/
printd
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
#!/bin/bash
### BEGIN INIT INFO
# processname: print-server
# chkconfig: - 86 15
# pidfile /home/www/print/logs/swoole/server.pid
### END INIT INFO
php=/usr/local/php7.1.16/bin/php
prog=print-server
prefix=/home/www/htdocs/print
exec_prefix=${prefix}
server_BIN=${exec_prefix}/server.php
server_PID=${prefix}/logs/swoole/server.pid
lockfile=/var/lock/subsys/print-server
case "$1" in
start)
echo -n "Starting $prog "
cd $prefix
$php server.php
if [ "$?" != 0 ] ; then
echo "failed"
else
echo "Starting success"
fi
;;
stop)
echo -n "Stopping $prog: "
if [ ! -r $server_PID ] ; then
echo "warning, no pid file found "
exit 1
fi
kill -15 `cat $server_PID`
if [ "$?" != 0 ] ; then
echo " failed"
exit 1
else
echo "Stopping success"
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
;;
esac