Fix return values in MySQL bootscript
authorHugo Villeneuve <hugo@hugovil.com>
Wed, 6 Aug 2014 04:04:22 +0000 (00:04 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Sat, 16 Aug 2014 00:43:52 +0000 (20:43 -0400)
stage3/bootscripts/mysql

index 3c5f935..d261939 100755 (executable)
@@ -14,15 +14,15 @@ mysql_start()
     if [ -f "$pid_file" ]; then
         if /bin/ps p `cat $pid_file` | grep mysqld >/dev/null; then
            # Warning, running...
-           return 0
+           return ${EXIT_CODE_WARNING}
        else
            rm -f $pid_file
            if [ -f $pid_file ]; then
-               return 1
+               return ${EXIT_CODE_FAILURE}
            fi
         fi
     fi
-    
+
     /usr/bin/mysqld_safe --user=mysql 2>&1 >/dev/null &
     return $?
 }
@@ -39,28 +39,28 @@ mysql_stop()
          sleep 1
        done
        if [ -s $pid_file ]; then
-           return 1
+           return ${EXIT_CODE_FAILURE}
        fi
        return 0
     else
         # print_status warning not_running
-        return 1
+        return ${EXIT_CODE_WARNING}
     fi
 }
 
 case "$1" in
     start)
-       cmd_run_log_box "MySQL start" mysql_start
+       cmd_run_log_box_warn "MySQL start" mysql_start
        ;;
-    
+
     stop)
-       cmd_run_log_box "MySQL stop" mysql_stop
+       cmd_run_log_box_warn "MySQL stop" mysql_stop
         ;;
-    
+
     reload)
-       cmd_run_log_box "MySQL reload" reloadproc mysqld
+       cmd_run_log_box_warn "MySQL reload" reloadproc mysqld
         ;;
+
     restart)
         $0 stop
         sleep 1
@@ -70,7 +70,7 @@ case "$1" in
     status)
         statusproc mysqld
         ;;
-    
+
     *)
        echo "Usage: $0 {start|stop|reload|restart|status}"
        exit ${EXIT_CODE_FAILURE}