summaryrefslogtreecommitdiffstats
path: root/initscript
diff options
context:
space:
mode:
authorSebastien Estienne <sebastien.estienne@gmail.com>2006-02-04 14:10:16 +0000
committerSebastien Estienne <sebastien.estienne@gmail.com>2006-02-04 14:10:16 +0000
commit0953bc5ff775acedc22a809570a1a8858cb649fb (patch)
treea063c70bed0870df35c436a91ed11d2f901bb4ac /initscript
parent5bf66ba8d479bbe613da1b9557b8aad2c448b536 (diff)
* added a status check
* don't try to start the daemon if already running * don't try to stop the daemon if already stopped * don't try reloading the config file if not running git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1129 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'initscript')
-rwxr-xr-xinitscript/debian/avahi-daemon.in23
-rwxr-xr-xinitscript/debian/avahi-dnsconfd.in23
2 files changed, 42 insertions, 4 deletions
diff --git a/initscript/debian/avahi-daemon.in b/initscript/debian/avahi-daemon.in
index feecc84..e942785 100755
--- a/initscript/debian/avahi-daemon.in
+++ b/initscript/debian/avahi-daemon.in
@@ -91,6 +91,9 @@ test -x $DAEMON || exit 0
# Function that starts the daemon/service.
#
d_start() {
+ $DAEMON -c
+ [ $? = 0 ] && exit 0
+
if [ -s /etc/localtime ]; then
if [ ! -d /etc/avahi/etc ]; then
mkdir -p @sysconfdir@/avahi/etc >/dev/null 2>&1
@@ -105,16 +108,29 @@ d_start() {
# Function that stops the daemon/service.
#
d_stop() {
- $DAEMON -k || /bin/true
+ $DAEMON -c
+ [ $? != 0 ] && exit 0
+
+ $DAEMON -k
}
#
# Function that reload the config file for the daemon/service.
#
d_reload() {
+ $DAEMON -c
+ [ $? != 0 ] && exit 0
+
$DAEMON -r
}
+#
+# Function that check the status of the daemon/service.
+#
+d_status() {
+ $DAEMON -c
+ [ $? = 0 ] && echo "$DESC is running" || echo "$DESC is not running"
+}
case "$1" in
start)
@@ -138,7 +154,10 @@ case "$1" in
d_start
log_end_msg $?
;;
- *)
+ status)
+ d_status
+ ;;
+ *)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload}" >&2
exit 1
;;
diff --git a/initscript/debian/avahi-dnsconfd.in b/initscript/debian/avahi-dnsconfd.in
index 649d72f..d100d17 100755
--- a/initscript/debian/avahi-dnsconfd.in
+++ b/initscript/debian/avahi-dnsconfd.in
@@ -91,6 +91,9 @@ test -x $DAEMON || exit 0
# Function that starts the daemon/service.
#
d_start() {
+ $DAEMON -c
+ [ $? = 0 ] && exit 0
+
if [ -s /etc/localtime ]; then
if [ ! -d /etc/avahi/etc ]; then
mkdir -p @sysconfdir@/avahi/etc >/dev/null 2>&1
@@ -105,16 +108,29 @@ d_start() {
# Function that stops the daemon/service.
#
d_stop() {
- $DAEMON -k || /bin/true
+ $DAEMON -c
+ [ $? != 0 ] && exit 0
+
+ $DAEMON -k
}
#
# Function that reload the config file for the daemon/service.
#
d_refresh() {
+ $DAEMON -c
+ [ $? != 0 ] && exit 0
+
$DAEMON -r
}
+#
+# Function that check the status of the daemon/service.
+#
+d_status() {
+ $DAEMON -c
+ [ $? = 0 ] && echo "$DESC is running" || echo "$DESC is not running"
+}
case "$1" in
start)
@@ -138,7 +154,10 @@ case "$1" in
d_start
log_end_msg $?
;;
- *)
+ status)
+ d_status
+ ;;
+ *)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload}" >&2
exit 1
;;