cjdroute init script
This commit is contained in:
parent
541c3a11d5
commit
8e5f179a9e
31
init.d/cjdroute
Executable file
31
init.d/cjdroute
Executable 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user