Skip to content

Commit e88ee79

Browse files
committed
add: this is init.d service script file
you can copy it to /etc/init.d/ which you can start the httpscws service.
1 parent 6e02a0f commit e88ee79

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

httpscws.service

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
# HTTPSCWS Startup script for the SCWS HTTP Server
3+
# this script create it by ivan at 2016.01.14.
4+
#
5+
# chkconfig: - 95 15
6+
# description: HTTPSCWS is an Chinese Word Segmentation System Based on the HTTP protocol.
7+
# processname: httpscws
8+
# pidfile: /var/run/httpscws.pid
9+
# config: /etc/scws/
10+
11+
httpscws=/usr/local/httpscws/bin/httpscws
12+
httpscws_config=/etc/scws/
13+
pid=/var/run/httpscws.pid
14+
15+
RETVAL=0
16+
prog="httpscws"
17+
18+
# Source function library.
19+
. /etc/rc.d/init.d/functions
20+
21+
# Source networking configuration.
22+
. /etc/sysconfig/network
23+
24+
# Check that networking is up.
25+
[ ${NETWORKING} = "no" ] && exit 0
26+
[ -x $httpscws ] || exit 0
27+
28+
# Start searchd daemons functions.
29+
start(){
30+
if [ -e $pid ]; then
31+
echo "$prog already running..."
32+
exit 1
33+
fi
34+
echo -n $"Starting $prog:"
35+
daemon $httpscws -l 127.0.0.1 -d -i ${pid} -x ${httpscws_config}
36+
RETVAL=$?
37+
echo
38+
[ $RETVAL = 0 ] && touch /var/lock/subsys/httpscws
39+
return $RETVAL
40+
}
41+
42+
# Stop searchd daemons functions.
43+
stop(){
44+
echo -n $"Stopping $prog:"
45+
killproc $httpscws
46+
RETVAL=$?
47+
echo
48+
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpscws $pid
49+
}
50+
51+
# See how we were called.
52+
case "$1" in
53+
start)
54+
start
55+
;;
56+
stop)
57+
stop
58+
;;
59+
restart)
60+
stop
61+
start
62+
;;
63+
status)
64+
status $prog
65+
RETVAL=$?
66+
;;
67+
*)
68+
echo $"Usage: $prog {start|stop|restart|status|help}"
69+
exit 1
70+
esac
71+
exit $RETVAL

0 commit comments

Comments
 (0)