updated init.d script. fixed whitespace v0.1-2
updated init.d script. fixed whitespace

--- a/wifischedule/files/etc/init.d/wifi_schedule
+++ b/wifischedule/files/etc/init.d/wifi_schedule
@@ -3,7 +3,16 @@
 START=99
 
 start() {
-	[ -x /usr/sbin/wifi_schedule ] && [ ! -f /var/run/wifi_schedule.pid ] && /usr/sbin/wifi_schedule &
+	if [ -x /usr/sbin/wifi_schedule ]
+	then
+		if [ -f /var/run/wifi_schedule.pid ] && [ "$(cat /var/run/wifi_schedule.pid)" -gt 0 ]
+		then
+			echo "wifi_schedule is running"
+		else
+                        echo "Starting wifi_schedule"
+                        /usr/sbin/wifi_schedule &
+		fi
+	fi
 }
 
 stop () {

--- a/wifischedule/files/usr/sbin/wifi_schedule
+++ b/wifischedule/files/usr/sbin/wifi_schedule
@@ -14,15 +14,15 @@
 	then
 		if [ "x$(uci -q -P /var/state/ get wireless.@wifi-iface[0].up)" != "x1" ]
 		then
-			logger "wifi_schedule: wifi is enabled $day_hour and wifi is off, turn on"
-			wifi up
+        	        logger "wifi_schedule: wifi is enabled $day_hour and wifi is off, turn on"
+                	wifi up
 		fi
 	else
 		if [ "x$(uci -q -P /var/state/ get wireless.@wifi-iface[0].up)" == "x1" ]
-		then
-			logger "wifi_schedule: wifi is disabled $day_hour and wifi is on, turn off"
-			wifi down
-		fi
+	        then
+        	        logger "wifi_schedule: wifi is disabled $day_hour and wifi is on, turn off"
+	                wifi down
+        	fi
 	fi
 
 	timetosleep=$(uci -q -c /var/wifi_schedule get wifi_schedule.@options[0].interval)
@@ -32,3 +32,4 @@
 	fi
 	sleep $timetosleep
 done
+

comments