]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - src/scripts/timecheck
git-svn-id: http://svn.ipfire.org/svn/ipfire/IPFire/source@16 ea5c0bd1-69bd-2848...
[people/teissler/ipfire-2.x.git] / src / scripts / timecheck
diff --git a/src/scripts/timecheck b/src/scripts/timecheck
new file mode 100644 (file)
index 0000000..4778a3f
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# IPCop CGIs
+#
+# This file is part of the IPCop Project
+# 
+# This code is distributed under the terms of the GPL
+#
+# (c) Eric Oberlander June 2002
+#
+# /usr/local/bin/timecheck
+
+if [ -e /var/ipcop/time/enable ]; then
+       if [ $(cat /var/ipcop/time/settings | grep period) ] && [ -e /var/ipcop/time/counter ]; then
+               if [ $(cat /var/ipcop/time/counter) -gt 0 ]; then
+                       echo $(($(cat /var/ipcop/time/counter)-5)) > /var/ipcop/time/counter
+               else
+                       touch /var/ipcop/time/settimenow
+                       rm -f /var/ipcop/time/counter
+               fi
+       else
+               # EAO added 2003-08-14 for v1.3.1
+               # if settings are restored from a backup
+               # /var/ipcop/time/counter will not exist
+               if [ $(cat /var/ipcop/time/settings | grep periodic) ]; then
+                       touch /var/ipcop/time/settimenow
+               fi
+       fi
+
+       if [ -e /var/ipcop/time/settimenow ]; then
+               if      [ -e /var/ipcop/time/settime.conf ]; then
+                       /usr/local/bin/settime $(cat /var/ipcop/time/settime.conf)
+               fi
+       fi
+fi