ssm-services/init.d/cjdroute

32 lines
812 B
Plaintext
Raw Normal View History

2013-11-05 14:10:22 +00:00
#!/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'
cjdroute_tun_interface='cjd0'
cjdroute_ipv6_addr='<put your ipv6 address here>'
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_tun_interface" ]] && { cjdroute.create_tun; } && watchman.start
}
stop() {
killall cjdroute
cjdroute.destroy_tun
}