Merge branch 'master' of github.com:fbt/watchman-services

This commit is contained in:
Jack L. Frost 2013-11-13 11:02:13 +04:00
commit 90d412c91f

View File

@ -3,13 +3,14 @@
unset reload unset reload
service_username='cjdns' service_username='cjdns'
service_command='/home/cjdns/cjdns/cjdroute' service_command='/usr/local/sbin/cjdroute'
service_args='< /home/cjdns/cjdns/cjdroute.conf' service_args='< /etc/cjdns/cjdroute.conf'
service_logfile='/home/cjdns/cjdns/cjdroute.log'
cjdroute_tun_interface='cjd0' cjdroute_tun_interface='cjd0'
cjdroute_ipv6_addr='fca7:8aef:6571:63c5:b23c:2fbc:8dea:e207/8' cjdroute_ipv6_addr='fca7:8aef:6571:63c5:b23c:2fbc:8dea:e207/8'
cjdroute_listen_port='7530' cjdroute_listen_port='11270'
service_pid=`lsof -i :"$cjdroute_listen_port" | tail -1 | cut -d ' ' -f 2`
service_pid=`lsof -i :"$cjdroute_listen_port" | tail -1 | cut -d ' ' -f 2` service_pid=`lsof -i :"$cjdroute_listen_port" | tail -1 | cut -d ' ' -f 2`
@ -24,10 +25,15 @@ cjdroute.destroy_tun() {
} }
start() { start() {
cjdroute.create_tun && watchman.start [[ "$service_username" ]] && {
cjdroute.create_tun || { return 1; }
}
watchman.start
} }
stop() { stop() {
watchman.stop watchman.stop
cjdroute.destroy_tun
[[ "$service_username" ]] && { cjdroute.destroy_tun; }
} }