From 7dd374f607fd71775bae43d0ac17c4e97495b8aa Mon Sep 17 00:00:00 2001 From: mcrane Date: Mon, 6 Apr 2009 16:49:16 -0600 Subject: Cron package monitor process --- config/cron/cron.inc | 31 +++++++++---------------------- config/cron/cron.tmp | 2 +- config/cron/cron.xml | 8 ++++---- pkg_config.7.xml | 2 +- 4 files changed, 15 insertions(+), 28 deletions(-) diff --git a/config/cron/cron.inc b/config/cron/cron.inc index 5636111c..380ecd05 100644 --- a/config/cron/cron.inc +++ b/config/cron/cron.inc @@ -48,25 +48,14 @@ function pkg_is_service_running($servicename) } } -function byte_convert( $bytes ) { - - if ($bytes<=0) - return '0 Byte'; - - $convention=1000; //[1000->10^x|1024->2^x] - $s=array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB'); - $e=floor(log($bytes,$convention)); - return round($bytes/pow($convention,$e),2).' '.$s[$e]; -} - - - function php_sync_package() { global $config; //synch cron tab configure_cron(); + $handle = popen("/usr/local/etc/rc.d/cron.sh start", "r"); + pclose($handle); } @@ -96,17 +85,15 @@ function php_install_command() //write_config(); - //write_rcfile(array( - // "file" => "cron.sh", - // "start" => "/usr/local/bin/php /usr/local/pkg/cron.php >> /var/log/cron.log &", - // "stop" => "rm /tmp/cron.pid" - // ) - //); + write_rcfile(array( + "file" => "cron.sh", + "start" => "/usr/sbin/cron -s &", + "stop" => "kill -9 `cat /var/run/cron.pid`" + ) + ); php_sync_package(); - //$handle = popen("/usr/local/etc/rc.d/cron.sh start", "r"); - //pclose($handle); - + //if (pkg_is_service_running('cron')) { //documentation purposes //} diff --git a/config/cron/cron.tmp b/config/cron/cron.tmp index 17bb3cc1..110dd8da 100644 --- a/config/cron/cron.tmp +++ b/config/cron/cron.tmp @@ -90,7 +90,7 @@ if ($config_change == 1) {

Cron controls the scheduling of commands.

- For more information see: http://www.freebsd.org/doc/en/books/handbook/configtuning-cron.html + For more information see: http://www.freebsd.org/doc/en/books/handbook/configtuning-cron.html

diff --git a/config/cron/cron.xml b/config/cron/cron.xml index 4fbe7ab6..f6338c7c 100644 --- a/config/cron/cron.xml +++ b/config/cron/cron.xml @@ -41,7 +41,7 @@ Describe your package requirements here Currently there are no FAQ items provided. Cron Settings - 0.2 + 0.1.2 Settings /usr/local/pkg/cron.inc @@ -52,10 +52,10 @@ /packages/cron/cron.php - cron + Cron cron.sh - cron - PHP run from a command line as a service. + /usr/sbin/cron + The cron utility is used to manage commands on a schedule. diff --git a/pkg_config.7.xml b/pkg_config.7.xml index 1054ccf3..d24f9af0 100755 --- a/pkg_config.7.xml +++ b/pkg_config.7.xml @@ -162,7 +162,7 @@ http://www.pfsense.com/packages/config/cron/cron.xml http://files.pfsense.org/packages/7/All/ - 0.1.1 + 0.1.2 Beta 1.2 markjcrane@gmail.com -- cgit v1.2.3