summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2007-01-29 04:09:12 +0000
committerScott Ullrich <sullrich@pfsense.org>2007-01-29 04:09:12 +0000
commit1071e028a5b7cd229cdcc30feacedb1e09069894 (patch)
tree940af601baa92648f100fdf808dc4e121ad0ab10 /etc
parentf2025e919e0cb7819db59e684c337f653aa6cc02 (diff)
downloadpfsense-1071e028a5b7cd229cdcc30feacedb1e09069894.zip
pfsense-1071e028a5b7cd229cdcc30feacedb1e09069894.tar.gz
Backport cron handling from HEAD.
Patches-submitted-by: DSH@
Diffstat (limited to 'etc')
-rw-r--r--etc/crontab10
-rw-r--r--etc/inc/pfsense-utils.inc3
-rw-r--r--etc/inc/services.inc48
-rwxr-xr-xetc/rc.bootup3
4 files changed, 55 insertions, 9 deletions
diff --git a/etc/crontab b/etc/crontab
index 1309474..8be8494 100644
--- a/etc/crontab
+++ b/etc/crontab
@@ -2,12 +2,4 @@ SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#minute hour mday month wday who command
-0 * * * * root /usr/bin/nice -n20 newsyslog
-1,31 0-5 * * * root /usr/bin/nice -n20 adjkerntz -a
-1 * 1 * * root /usr/bin/nice -n20 /etc/rc.update_bogons.sh
-*/60 * * * * root /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 sshlockout
-1 1 * * * root /usr/bin/nice -n20 /etc/rc.dyndns.update
-*/60 * * * * root /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 virusprot
-*/60 * * * * root /usr/bin/nice -n20 /usr/local/sbin/expiretable -t 1800 snort2c
-*/60 * * * * root /usr/bin/nice -n20 /usr/local/sbin/expiretable -t 1800 snort2c
-*/5 * * * * root /usr/local/bin/checkreload.sh \ No newline at end of file
+# \ No newline at end of file
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 190ce10..e1f511d 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -1851,6 +1851,9 @@ function reload_all_sync() {
/* start DHCP service */
services_dhcpd_configure();
+ /* configure cron service */
+ configure_cron();
+
/* start the NTP client */
system_ntp_configure();
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index 81252e1..0832212 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -1181,4 +1181,52 @@ EODAD;
conf_mount_ro();
}
+/* configure cron service */
+function configure_cron() {
+ global $g, $config;
+ if (!$g['booting'])
+ conf_mount_rw();
+ /* preserve existing crontab entries */
+ $crontab_contents = file_get_contents("/etc/crontab");
+ $crontab_contents_a = split("\n", $crontab_contents);
+
+ for ($i = 0; $i < count($crontab_contents_a); $i++) {
+ $item =& $crontab_contents_a[$i];
+ if (strpos($item, "# pfSense specific crontab entries") !== false) {
+ array_splice($crontab_contents_a, $i - 1);
+ break;
+ }
+ }
+ $crontab_contents = implode("\n", $crontab_contents_a) . "\n";
+
+
+ if (is_array($config['cron']['item'])) {
+ $crontab_contents .= "#\n";
+ $crontab_contents .= "# pfSense specific crontab entries\n";
+ $crontab_contents .= "# Created: " . date("F j, Y, g:i a") . "\n";
+ $crontab_contents .= "#\n";
+
+ foreach ($config['cron']['item'] as $item) {
+ $crontab_contents .= "\n{$item['minute']}\t";
+ $crontab_contents .= "{$item['hour']}\t";
+ $crontab_contents .= "{$item['mday']}\t";
+ $crontab_contents .= "{$item['month']}\t";
+ $crontab_contents .= "{$item['wday']}\t";
+ $crontab_contents .= "{$item['who']}\t";
+ $crontab_contents .= "{$item['command']}";
+ }
+
+ $crontab_contents .= "\n#\n";
+ $crontab_contents .= "# If possible do not add items to this file manually.\n";
+ $crontab_contents .= "# If you do so, this file must be terminated with a blank line (e.g. new line)\n";
+ $crontab_contents .= "#\n\n";
+ }
+
+ /* please maintain the newline at the end of file */
+ file_put_contents("/etc/crontab", $crontab_contents);
+
+ if (!$g['booting'])
+ conf_mount_ro();
+}
+
?>
diff --git a/etc/rc.bootup b/etc/rc.bootup
index 6d18662..1c251d5 100755
--- a/etc/rc.bootup
+++ b/etc/rc.bootup
@@ -205,6 +205,9 @@
system_webgui_start();
}
+ /* configure cron service */
+ configure_cron();
+
/* set up static routes */
system_routing_configure();
OpenPOWER on IntegriCloud