cjdroute pid detection

This commit is contained in:
Jack L. Frost 2013-11-09 01:39:33 +04:00
parent 8e5f179a9e
commit fdb9b0de95

View File

@ -1,15 +1,15 @@
#!/usr/bin/env watchman
# An example cjdroute init script with a custom interface
unset reload
service_username='cjdroute'
service_command='/home/cjdroute/cjdns/cjdroute'
service_args='< /home/cjdroute/cjdns/cjdroute.conf'
service_logfile='/home/cjdroute/cjdns/cjdroute.log'
service_username='cjdns'
service_command='/home/cjdns/cjdns/cjdroute'
service_args='< /home/cjdns/cjdns/cjdroute.conf'
service_logfile='/home/cjdns/cjdns/cjdroute.log'
cjdroute_tun_interface='cjd0'
cjdroute_ipv6_addr='<put your ipv6 address here>'
cjdroute_ipv6_addr='fca7:8aef:6571:63c5:b23c:2fbc:8dea:e207/8'
cjdroute_listen_port='7530'
cjdroute.create_tun() {
ip tuntap add mode tun user "$service_username" group "$service_username" "$cjdroute_tun_interface"
@ -22,10 +22,11 @@ cjdroute.destroy_tun() {
}
start() {
[[ "$cjdroute_tun_interface" ]] && { cjdroute.create_tun; } && watchman.start
cjdroute.create_tun && watchman.start
}
stop() {
killall cjdroute
service_pid=`lsof -i :"$cjdroute_listen_port" | tail -1 | cut -d ' ' -f 2`
watchman.stop
cjdroute.destroy_tun
}