ssm-services/init.d/cjdroute
2013-11-09 01:41:42 +04:00

34 lines
816 B
Plaintext
Executable File

#!/usr/bin/env watchman
unset reload
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='fca7:8aef:6571:63c5:b23c:2fbc:8dea:e207/8'
cjdroute_listen_port='7530'
service_pid=`lsof -i :"$cjdroute_listen_port" | tail -1 | cut -d ' ' -f 2`
cjdroute.create_tun() {
ip tuntap add mode tun user "$service_username" group "$service_username" "$cjdroute_tun_interface"
ip a add "$cjdroute_ipv6_addr" dev "$cjdroute_tun_interface"
ip link set "$cjdroute_tun_interface" up
}
cjdroute.destroy_tun() {
ip tuntap del mode tun "$cjdroute_tun_interface"
}
start() {
cjdroute.create_tun && watchman.start
}
stop() {
watchman.stop
cjdroute.destroy_tun
}