Merge branch 'master' of builder:git/watchman-services

This commit is contained in:
Jack L. Frost 2015-01-27 10:16:15 +03:00
commit ee4437f721
2 changed files with 5 additions and 13 deletions

View File

@ -2,8 +2,8 @@
# Two warnings: # Two warnings:
# 1) This script uses a script to run cjdroute and feed it # 1) This script uses a script to run cjdroute and feed it
# the config. It can be found in the main cjdns repo: # the config. It can be found in the main cjdns repo:
# contrib/bash/run-cjdroute.bash # contrib/sh/run-cjdroute.sh
# Or here: http://sprunge.us/gYKX # Or here: http://ix.io/fYT
# 2) service_respawn is disabled by default because you need # 2) service_respawn is disabled by default because you need
# "noBackground":1 in cjdroute.conf for it to actually work. # "noBackground":1 in cjdroute.conf for it to actually work.
# Barely. # Barely.
@ -12,8 +12,6 @@ unset reload
#service_respawn=true #service_respawn=true
service_command='/usr/bin/run-cjdroute' service_command='/usr/bin/run-cjdroute'
cjdroute_config='/etc/cjdroute.conf'
cjdroute_admin_port='11234' cjdroute_admin_port='11234'
cjdroute.check_tun_module() { cjdroute.check_tun_module() {
@ -27,12 +25,6 @@ cjdroute.check_tun_module() {
start() { start() {
cjdroute.check_tun_module || { return 1; } cjdroute.check_tun_module || { return 1; }
[[ -e "$cjdroute_config" ]] || {
watchman.err "$cjdroute_config does not exist, please create it by running cjdroute --genconf >> /etc/cjdroute.conf"
return 1
}
watchman.start watchman.start
} }
@ -40,7 +32,7 @@ stop() {
[[ "$service_respawn" == 'true' ]] && { watchman.stop; } # stopping the watchdog [[ "$service_respawn" == 'true' ]] && { watchman.stop; } # stopping the watchdog
# Stopping the actual s-o-b daemon that won't die properly. # Stopping the actual s-o-b daemon that won't die properly.
cjdroute_control_pid=`lsof -i :"$cjdroute_admin_port" | tail -1 | cut -d ' ' -f 2` cjdroute_control_pid=$(lsof -i :"$cjdroute_admin_port" | tail -1 | cut -d ' ' -f 2)
watchman.pid_check "$cjdroute_control_pid" && { watchman.pid_check "$cjdroute_control_pid" && {
kill "$cjdroute_control_pid" kill "$cjdroute_control_pid"
watchman.pid_wait "$cjdroute_control_pid" watchman.pid_wait "$cjdroute_control_pid"

View File

@ -10,8 +10,8 @@ wait_for_iface() {
local iface="$1" timer='0' timeout='6' local iface="$1" timer='0' timeout='6'
until [[ "ip link show $iface up" ]]; do until [[ "ip link show $iface up" ]]; do
[[ "$timer" -ge "$timeout" ]] && { return 1; } (( timer >= timeout )) && { return 1; }
timer=$[timer+1] (( timer++ ))
done done
} }