From c38395f0cdb9ee11b219751aa832d90c2ef2a694 Mon Sep 17 00:00:00 2001 From: Nicolas Thill Date: Sun, 13 Nov 2011 22:16:25 +0000 Subject: [PATCH] packages/bird: use new service functions SVN-Revision: 29079 --- net/bird/Makefile | 2 +- net/bird/files/bird4.init | 17 ++++++++--------- net/bird/files/bird4loop | 23 +++++++++++++++++------ net/bird/files/bird6.init | 17 ++++++++--------- net/bird/files/bird6loop | 23 +++++++++++++++++------ 5 files changed, 51 insertions(+), 31 deletions(-) diff --git a/net/bird/Makefile b/net/bird/Makefile index 36e7ae2b7..1f446e6a9 100644 --- a/net/bird/Makefile +++ b/net/bird/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bird PKG_VERSION:=1.3.3 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=bird-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=ftp://bird.network.cz/pub/bird diff --git a/net/bird/files/bird4.init b/net/bird/files/bird4.init index d0e0876e9..8ac5e7591 100644 --- a/net/bird/files/bird4.init +++ b/net/bird/files/bird4.init @@ -1,22 +1,21 @@ #!/bin/sh /etc/rc.common +# Copyright (C) 2010-2011 OpenWrt.org START=50 -# Birdloop is used to restart BIRD if it crashed. Unfortunately, it also -# hides and handles in the same manner start-time errors (like parse error -# in config file). Therefore, it is not used by default. If you want to -# use it, comment the first line and uncomment the second line in start(). +SERVICE_DAEMONIZE=1 +SERVICE_WRITE_PID=1 start() { - /usr/sbin/bird4 -# /usr/sbin/bird4loop + service_start /usr/sbin/bird4 -d +# ( SERVICE_MATCH_NAME=1 service_start /usr/sbin/bird4loop ) } stop() { - killall bird4 - sleep 1 +# ( SERVICE_MATCH_NAME=1 service_stop /usr/sbin/bird4loop ) + service_stop /usr/sbin/bird4 } reload() { - killall -HUP bird4 + service_reload /usr/sbin/bird4 } diff --git a/net/bird/files/bird4loop b/net/bird/files/bird4loop index 9d9b80dd8..5dd6b95c9 100644 --- a/net/bird/files/bird4loop +++ b/net/bird/files/bird4loop @@ -2,11 +2,22 @@ BIRD=/usr/sbin/bird4 -$BIRD -p +$BIRD -p || return 1 -( until $BIRD -d "$@" -do - logger error BIRD4 died! - sleep 2 -done; ) /dev/null 2> /dev/null & +. /lib/functions.sh +SERVICE_DAEMONIZE=1 +SERVICE_WRITE_PID=1 + +sig_handler() { + running=0 + service_stop $BIRD +} + +running=1 +trap sig_handler INT +trap sig_handler TERM +while [ $running -gt 0 ]; do + service_check $BIRD || service_start $BIRD -d "$@" + sleep 3 +done diff --git a/net/bird/files/bird6.init b/net/bird/files/bird6.init index 69b39ff14..2efb4f096 100644 --- a/net/bird/files/bird6.init +++ b/net/bird/files/bird6.init @@ -1,22 +1,21 @@ #!/bin/sh /etc/rc.common +# Copyright (C) 2010-2011 OpenWrt.org START=50 -# Birdloop is used to restart BIRD if it crashed. Unfortunately, it also -# hides and handles in the same manner start-time errors (like parse error -# in config file). Therefore, it is not used by default. If you want to -# use it, comment the first line and uncomment the second line in start(). +SERVICE_DAEMONIZE=1 +SERVICE_WRITE_PID=1 start() { - /usr/sbin/bird6 -# /usr/sbin/bird6loop + service_start /usr/sbin/bird6 -d +# ( SERVICE_MATCH_NAME=1 service_start /usr/sbin/bird6loop ) } stop() { - killall bird6 - sleep 1 +# ( SERVICE_MATCH_NAME=1 service_stop /usr/sbin/bird6loop ) + service_stop /usr/sbin/bird6 } reload() { - killall -HUP bird6 + service_reload /usr/sbin/bird6 } diff --git a/net/bird/files/bird6loop b/net/bird/files/bird6loop index 569212585..46f498a06 100644 --- a/net/bird/files/bird6loop +++ b/net/bird/files/bird6loop @@ -2,11 +2,22 @@ BIRD=/usr/sbin/bird6 -$BIRD -p +$BIRD -p || return 1 -( until $BIRD -d "$@" -do - logger error BIRD6 died! - sleep 2 -done; ) /dev/null 2> /dev/null & +. /lib/functions.sh +SERVICE_DAEMONIZE=1 +SERVICE_WRITE_PID=1 + +sig_handler() { + running=0 + service_stop $BIRD +} + +running=1 +trap sig_handler INT +trap sig_handler TERM +while [ $running -gt 0 ]; do + service_check $BIRD || service_start $BIRD -d "$@" + sleep 3 +done -- 2.30.2