2013-11-05 14:10:22 +00:00
|
|
|
#!/usr/bin/env watchman
|
|
|
|
|
|
|
|
unset reload
|
|
|
|
|
2013-11-08 21:39:33 +00:00
|
|
|
service_username='cjdns'
|
2013-11-09 18:37:01 +00:00
|
|
|
service_command='/usr/local/sbin/cjdroute'
|
2013-11-05 14:10:22 +00:00
|
|
|
|
2013-12-24 15:13:49 +00:00
|
|
|
cjdroute_config='/etc/cjdroute.conf'
|
|
|
|
cjdroute_tun_interface='cjdns0'
|
|
|
|
cjdroute_listen_port=''
|
2013-11-05 14:10:22 +00:00
|
|
|
|
2013-11-09 18:28:54 +00:00
|
|
|
service_pid=`lsof -i :"$cjdroute_listen_port" | tail -1 | cut -d ' ' -f 2`
|
2013-11-05 14:10:22 +00:00
|
|
|
|
2013-11-13 07:04:27 +00:00
|
|
|
cjdroute.check_tun_module() {
|
|
|
|
[[ -e '/dev/net/tun' ]] || {
|
|
|
|
modprobe tun || {
|
|
|
|
watchman.err "Could not load module tun!"
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-05 14:10:22 +00:00
|
|
|
start() {
|
2013-11-13 07:04:27 +00:00
|
|
|
cjdroute.check_tun_module || { return 1; }
|
2013-12-24 15:13:49 +00:00
|
|
|
"$service_command" < "$cjdroute_config"
|
2013-11-05 14:10:22 +00:00
|
|
|
}
|