mdserver-web/plugins/simdht/init.d/simdht.tpl

44 lines
805 B
Smarty
Raw Normal View History

2019-01-10 00:13:18 -05:00
#!/bin/sh
# chkconfig: 2345 55 25
2019-01-10 04:50:53 -05:00
# description: DHTSpider Service
2019-01-10 00:13:18 -05:00
### BEGIN INIT INFO
2019-01-10 04:50:53 -05:00
# Provides: DHTSpider
2019-01-10 00:13:18 -05:00
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
2019-01-10 04:50:53 -05:00
# Short-Description: starts DHTSpider
2019-01-10 00:13:18 -05:00
# Description: starts the MDW-Web
### END INIT INFO
2019-01-10 04:50:53 -05:00
dht_start(){
cd {$SERVER_PATH}/simdht/workers
2019-01-10 11:09:06 -05:00
nohup python simdht_worker.py > {$SERVER_PATH}/simdht/logs.pl 2>&1 &
2019-01-10 00:13:18 -05:00
}
2019-01-10 04:50:53 -05:00
dht_stop(){
echo "Stopping ..."
ps -ef | grep "python simdht" | grep -v grep | awk '{print $2}' | xargs kill
echo "Redis stopped"
2019-01-10 00:13:18 -05:00
}
case "$1" in
start)
2019-01-10 04:50:53 -05:00
dht_start
2019-01-10 00:13:18 -05:00
;;
stop)
2019-01-10 04:50:53 -05:00
dht_stop
2019-01-10 00:13:18 -05:00
;;
restart|reload)
2019-01-10 04:50:53 -05:00
dht_stop
2019-01-10 00:13:18 -05:00
sleep 0.3
2019-01-10 04:50:53 -05:00
dht_start
2019-01-10 00:13:18 -05:00
;;
*)
echo "Please use start or stop as first argument"
;;
esac