diff options
Diffstat (limited to '00-pdnsd')
-rwxr-xr-x | 00-pdnsd | 41 |
1 files changed, 29 insertions, 12 deletions
@@ -11,23 +11,15 @@ no_valid_init() { exit 1 } -pdnsd_going_up() { - # Check whether pDNSd is already running before starting it. +pdnsd_is_runnning() { + # Check whether pDNSd is running. case "$INIT" in 'systemd') systemctl is-active pdnsd.service -q - if [ ! $? = 0 ]; then - systemctl start pdnsd.service - else - systemctl restart pdnsd.service - fi + return [ ! $? = 0 ] ;; 'init') - if [ `rc.d list|grep pdnsd|cut -f1 -d']'|cut -d'[' -f2` == 'STOPPED' ]; then - rc.d start pdnsd - else - rc.d restart pdnsd - fi + return [ `rc.d list|grep pdnsd|cut -f1 -d']'|cut -d'[' -f2` == 'STARTED' ] ;; *) no_valid_init @@ -35,6 +27,31 @@ pdnsd_going_up() { esac } +pdnsd_going_up() { + if [ ! pdnsd_is_running ]; then + # pDNSd isn't running. Start it. + case "$INIT" in + 'systemd') + systemctl start pdnsd.service + ;; + 'init') + rc.d start pdnsd + ;; + esac + else + # pDNSd is running. Restart it. + case "$INIT" in + 'systemd') + systemctl restart pdnsd.service + ;; + 'init') + rc.d restart pdnsd + ;; + esac + + fi +} + pdnsd_going_down() { # Check for active interface, take offline if none is active if [ ! `nm-tool|grep State|cut -f2 -d' '` = 'connected' ]; then |