cjdroute init script

This commit is contained in:
Jack L. Frost 2013-11-05 18:10:22 +04:00
parent 541c3a11d5
commit 8e5f179a9e
1 changed files with 31 additions and 0 deletions

31
init.d/cjdroute Executable file
View File

@ -0,0 +1,31 @@
#!/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
}