-/* Ipcop helper program - restartntpd\r
- *\r
- * Starts or stops the ntpd daemon\r
- *\r
- * (c) Darren Critchley 2003\r
- * \r
- * $Id: restartntpd.c,v 1.5 2003/12/19 14:29:09 riddles Exp $\r
- * \r
- */\r
- \r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <unistd.h>\r
-#include <stdlib.h>\r
-#include <sys/types.h>\r
-#include <fcntl.h>\r
-#include "setuid.h"\r
-\r
-\r
-int main(void)\r
-{\r
- int fd = -1;\r
- int enable = 0;\r
-\r
- if (!(initsetuid()))\r
- exit(1);\r
- \r
- safe_system("/bin/killall ntpd 2> /dev/null");\r
- sleep(3);\r
-\r
- if ((fd = open(CONFIG_ROOT "/time/allowclients", O_RDONLY)) != -1)\r
- {\r
- close(fd);\r
- enable = 1;\r
- }\r
-\r
- if (enable)\r
- {\r
- safe_system("/usr/bin/ntpd -Ap /var/run/ntpd.pid -u ntp:ntp");\r
- }\r
- return 0;\r
-}\r
+/* IPFire helper program - restartntpd
+ *
+ * Starts or stops the ntpd daemon
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include "setuid.h"
+
+
+int main(void)
+{
+ int fd = -1;
+ int enable = 0;
+
+ if (!(initsetuid()))
+ exit(1);
+
+ safe_system("/etc/rc.d/init.d/ntp stop 2>&1 >/dev/null");
+ sleep(3);
+
+ if ((fd = open(CONFIG_ROOT "/time/allowclients", O_RDONLY)) != -1)
+ {
+ close(fd);
+ enable = 1;
+ }
+
+ if (enable)
+ {
+ safe_system("/etc/rc.d/init.d/ntp start 2>&1 >/dev/null");
+ }
+ return 0;
+}