Cosmetics + added a check for the existence of the configuration file.
authorFrancois Fleuret <francois@fleuret.org>
Sun, 26 Apr 2009 20:19:26 +0000 (22:19 +0200)
committerFrancois Fleuret <francois@fleuret.org>
Sun, 26 Apr 2009 20:19:26 +0000 (22:19 +0200)
breezed.sh

index 255386b..5de38f6 100755 (executable)
@@ -2,7 +2,7 @@
 
 #  breezed is a fan speed control daemon for Linux computers.
 #
-#  Copyright (c) 2008 Francois Fleuret
+#  Copyright (c) 2008, 2009 Francois Fleuret
 #  Written by Francois Fleuret <francois@fleuret.org>
 #
 #  This file is part of breezed.
@@ -29,6 +29,7 @@
 ### END INIT INFO
 
 DAEMON="/usr/local/bin/breezed"
+CONF_FILE="/etc/breezed.conf"
 
 test -x $DAEMON || exit 0
 
@@ -37,11 +38,15 @@ test -x $DAEMON || exit 0
 case "$1" in
 
     start)
-        log_daemon_msg "Starting fan control daemon" "breezed"
-        start-stop-daemon --start --background --quiet \
-            --make-pidfile --pidfile /var/run/breezed.pid \
-            --exec ${DAEMON}
-        log_end_msg $?
+        if [[ -f "${CONF_FILE}" ]]; then
+            log_daemon_msg "Starting fan control daemon" "breezed"
+            start-stop-daemon --start --background --quiet \
+                --make-pidfile --pidfile /var/run/breezed.pid \
+                --exec ${DAEMON}
+            log_end_msg $?
+        else
+            log_failure_msg "Can not find ${CONF_FILE}."
+        fi
        ;;
 
     restart)