pidfiles are evil
This commit is contained in:
parent
c9168818d4
commit
4bf86dc02f
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
unset reload
|
unset reload
|
||||||
|
|
||||||
service_command='/usr/bin/cjdroute'
|
service_command='/usr/local/sbin/cjdroute-start'
|
||||||
|
service_respawn=true
|
||||||
|
|
||||||
cjdroute_config='/etc/cjdroute.conf'
|
cjdroute_config='/etc/cjdroute.conf'
|
||||||
cjdroute_admin_port='11234'
|
cjdroute_admin_port='11234'
|
||||||
|
@ -16,10 +17,6 @@ cjdroute.check_tun_module() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get_pid() {
|
|
||||||
lsof -i :"$cjdroute_admin_port" | tail -1 | cut -d ' ' -f 2
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
cjdroute.check_tun_module || { return 1; }
|
cjdroute.check_tun_module || { return 1; }
|
||||||
|
|
||||||
|
@ -28,7 +25,16 @@ start() {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
"$service_command" < "${cjdroute_config}" &>"$service_logfile" && {
|
watchman.start
|
||||||
watchman.msg "${service_name} started"
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
[[ "$service_respawn" == 'true' ]] && { watchman.stop; } # stopping the watchdog
|
||||||
|
|
||||||
|
# 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`
|
||||||
|
watchman.pid_check "$cjdroute_control_pid" && {
|
||||||
|
kill "$cjdroute_control_pid"
|
||||||
|
watchman.pid_wait "$cjdroute_control_pid"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env watchman
|
#!/usr/bin/env watchman
|
||||||
|
|
||||||
|
service_respawn=true
|
||||||
service_command='/usr/bin/dbus-daemon'
|
service_command='/usr/bin/dbus-daemon'
|
||||||
service_args='--system'
|
service_args='--system --nofork'
|
||||||
service_pidfile='/run/dbus/pid'
|
|
||||||
|
|
||||||
start_pre() {
|
start_pre() {
|
||||||
/usr/bin/dbus-uuidgen --ensure=/etc/machine-id
|
/usr/bin/dbus-uuidgen --ensure=/etc/machine-id
|
||||||
|
@ -13,8 +13,3 @@ start() {
|
||||||
start_pre
|
start_pre
|
||||||
watchman.start
|
watchman.start
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
|
||||||
[[ -e "$service_pidfile" ]] && { rm "$service_pidfile"; }
|
|
||||||
watchman.stop
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/env watchman
|
#!/usr/bin/env watchman
|
||||||
# dhcp client daemon initscript
|
# dhcp client daemon initscript
|
||||||
|
|
||||||
|
service_respawn=true
|
||||||
service_command='/usr/sbin/dhcpcd'
|
service_command='/usr/sbin/dhcpcd'
|
||||||
service_pidfile='/var/run/dhcpcd.pid'
|
service_args='-B -C resolv.conf'
|
||||||
|
|
||||||
source "${cfg_dir}/conf.d/dhcpcd.sh"
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
#!/usr/bin/env watchman
|
#!/usr/bin/env watchman
|
||||||
|
|
||||||
|
service_respawn=true
|
||||||
service_command='/bin/dropbear'
|
service_command='/bin/dropbear'
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env watchman
|
#!/usr/bin/env watchman
|
||||||
|
|
||||||
|
service_respawn=true
|
||||||
service_command='/bin/mpd'
|
service_command='/bin/mpd'
|
||||||
service_pidfile='/run/mpd.pid'
|
service_args='--no-daemon'
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
cfg_nrpe_config='/etc/nrpe/nrpe.cfg'
|
cfg_nrpe_config='/etc/nrpe/nrpe.cfg'
|
||||||
|
|
||||||
|
service_respawn=true
|
||||||
service_command='/usr/bin/nrpe'
|
service_command='/usr/bin/nrpe'
|
||||||
service_pidfile='/run/nrpe.pid'
|
service_pidfile='/run/nrpe.pid'
|
||||||
service_args="-c ${cfg_nrpe_config} -d"
|
service_args="-c ${cfg_nrpe_config} -d"
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
cfg_ntpd_config='/etc/ntp.conf'
|
cfg_ntpd_config='/etc/ntp.conf'
|
||||||
|
|
||||||
|
service_respawn='true'
|
||||||
service_command='/bin/ntpd'
|
service_command='/bin/ntpd'
|
||||||
service_pidfile='/run/ntpd.pid'
|
service_args="-c $cfg_ntpd_config -n"
|
||||||
service_args="-c $cfg_ntpd_config -p $service_pidfile"
|
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
privoxy_username='privoxy'
|
privoxy_username='privoxy'
|
||||||
privoxy_configfile='/etc/privoxy/config'
|
privoxy_configfile='/etc/privoxy/config'
|
||||||
|
|
||||||
|
service_respawn='true'
|
||||||
service_command='/usr/bin/privoxy'
|
service_command='/usr/bin/privoxy'
|
||||||
service_pidfile='/run/privoxy.pid'
|
service_args="--no-daemon --user ${privoxy_username} ${privoxy_configfile}"
|
||||||
service_args="--pidfile ${service_pidfile} --user ${privoxy_username} ${privoxy_configfile}"
|
|
||||||
|
|
||||||
privoxy::configtest() {
|
privoxy::configtest() {
|
||||||
"${service_command}" --config-test ${service_args}
|
"${service_command}" --config-test ${service_args}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
cfg_sshd_cfgdir='/etc/ssh'
|
cfg_sshd_cfgdir='/etc/ssh'
|
||||||
|
|
||||||
|
service_respawn=true
|
||||||
service_command='/bin/sshd'
|
service_command='/bin/sshd'
|
||||||
service_args="-f $cfg_sshd_cfgdir/sshd_config"
|
service_args="-D -f $cfg_sshd_cfgdir/sshd_config"
|
||||||
service_pidfile='/run/sshd.pid'
|
|
||||||
|
|
||||||
sshd_genkeys() {
|
sshd_genkeys() {
|
||||||
[[ -e "/etc/ssh/ssh_host_key" ]] || { ssh-keygen -A; }
|
[[ -e "/etc/ssh/ssh_host_key" ]] || { ssh-keygen -A; }
|
||||||
|
|
|
@ -13,3 +13,9 @@ done
|
||||||
service_type='oneshot'
|
service_type='oneshot'
|
||||||
service_command='/sbin/sysctl'
|
service_command='/sbin/sysctl'
|
||||||
service_args="-p /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf"
|
service_args="-p /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf"
|
||||||
|
|
||||||
|
start() {
|
||||||
|
watchman.start
|
||||||
|
}
|
||||||
|
|
||||||
|
unset restart reload
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env watchman
|
#!/usr/bin/env watchman
|
||||||
|
|
||||||
|
service_respawn=true
|
||||||
service_command='/bin/syslog-ng'
|
service_command='/bin/syslog-ng'
|
||||||
service_pidfile='/run/syslog-ng.pid'
|
service_args='-F'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env watchman
|
#!/usr/bin/env watchman
|
||||||
|
|
||||||
|
service_respawn=true
|
||||||
service_command='/usr/bin/xinetd'
|
service_command='/usr/bin/xinetd'
|
||||||
service_pidfile="/run/xinetd.pid"
|
service_args='-dontfork'
|
||||||
service_args="-pidfile $service_pidfile"
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user