Commit bd07877f authored by Franco Fichtner's avatar Franco Fichtner

cron: slight review of the current code base; closes #946

parent 7700f7c7
...@@ -245,13 +245,13 @@ echo "done." ...@@ -245,13 +245,13 @@ echo "done."
/usr/local/etc/rc.opnsense start /usr/local/etc/rc.opnsense start
# Start ping handler every 240 seconds # Start ping handler every 240 seconds
minicron 240 /var/run/ping_hosts.pid /usr/local/sbin/ping_hosts.sh /usr/local/bin/minicron 240 /var/run/ping_hosts.pid /usr/local/sbin/ping_hosts.sh
# Start account expire handler every hour # Start account expire handler every hour
minicron 3600 /var/run/expire_accounts.pid /usr/local/etc/rc.expireaccounts /usr/local/bin/minicron 3600 /var/run/expire_accounts.pid /usr/local/etc/rc.expireaccounts
# Start alias url updater every 24 hours # Start alias url updater every 24 hours
minicron 86400 /var/run/update_alias_url_data.pid /usr/local/etc/rc.update_alias_url_data /usr/local/bin/minicron 86400 /var/run/update_alias_url_data.pid /usr/local/etc/rc.update_alias_url_data
/usr/local/sbin/beep.sh start /usr/local/sbin/beep.sh start
......
<?php <?php
/** /**
* Copyright (C) 2015 Deciso B.V. * Copyright (C) 2015 Deciso B.V.
* *
...@@ -26,6 +27,7 @@ ...@@ -26,6 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
namespace OPNsense\Cron\Api; namespace OPNsense\Cron\Api;
use \OPNsense\Base\ApiControllerBase; use \OPNsense\Base\ApiControllerBase;
......
<?php <?php
/** /**
* Copyright (C) 2015 Deciso B.V. * Copyright (C) 2015 Deciso B.V.
* *
...@@ -26,6 +27,7 @@ ...@@ -26,6 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
namespace OPNsense\Cron\Api; namespace OPNsense\Cron\Api;
use \OPNsense\Base\ApiControllerBase; use \OPNsense\Base\ApiControllerBase;
......
<acl>
<!-- unique acl key, must be globally unique for all acl's -->
<page-system-cron>
<name>WebCfg - System: Settings: Cron page</name>
<description>Allow access to the 'System: Settings: Cron' page.</description>
<patterns>
<pattern>ui/cron/*</pattern>
<pattern>api/cron/*</pattern>
</patterns>
</page-system-cron>
</acl>
<?php <?php
/** /**
* Copyright (C) 2015 Deciso B.V. * Copyright (C) 2015 Deciso B.V.
* *
...@@ -26,6 +27,7 @@ ...@@ -26,6 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
namespace OPNsense\Cron; namespace OPNsense\Cron;
use OPNsense\Base\BaseModel; use OPNsense\Base\BaseModel;
......
<model> <model>
<mount>//OPNsense/cron</mount> <mount>//OPNsense/cron</mount>
<description> <description>Cron settings</description>
(minicron) cron settings
</description>
<items> <items>
<jobs> <jobs>
<job type="ArrayField"> <job type="ArrayField">
...@@ -18,32 +16,32 @@ ...@@ -18,32 +16,32 @@
<minutes type="TextField"> <minutes type="TextField">
<default>0</default> <default>0</default>
<Required>Y</Required> <Required>Y</Required>
<mask>/^((?:\*|[1-5][0-9]|0[0-9]|[0-9])(,{1}|-{1}|$))+$/</mask> <mask>/^((?:\*|[1-5][0-9]|0[0-9]|[0-9])(,{1}|-{1}|\/{1}|$))+$/</mask>
<ValidationMessage>Value needs to be between 0 and 59, multiple values, ranges and * are supported (ex. 1,10,20,30 or 1-30 )</ValidationMessage> <ValidationMessage>Value needs to be between 0 and 59; multiple values, ranges, steps and asterisk are supported (ex. 1,10,20,30 or 1-30)</ValidationMessage>
</minutes> </minutes>
<hours type="TextField"> <hours type="TextField">
<default>0</default> <default>0</default>
<Required>Y</Required> <Required>Y</Required>
<mask>/^((?:\*|([1][0-9]|[2][0-3])|0[0-9]|[0-9])(,{1}|-{1}|$))+$/</mask> <mask>/^((?:\*|([1][0-9]|[2][0-3])|0[0-9]|[0-9])(,{1}|-{1}|\/{1}|$))+$/</mask>
<ValidationMessage>Value needs to be between 0 and 23, multiple values, ranges and * are supported (ex. 1,2,8 or 0-8 )</ValidationMessage> <ValidationMessage>Value needs to be between 0 and 23; multiple values, ranges, steps and asterisk are supported (ex. 1,2,8 or 0-8)</ValidationMessage>
</hours> </hours>
<days type="TextField"> <days type="TextField">
<default>*</default> <default>*</default>
<Required>Y</Required> <Required>Y</Required>
<mask>/^(((?:\*|[1-2][0-9]|0[1-9]|[1-9]|[3][0-1])(,{1}|-{1}|$))+|L)$/</mask> <mask>/^(((?:\*|[1-2][0-9]|0[1-9]|[1-9]|[3][0-1])(,{1}|-{1}|\/{1}|$))+|L)$/</mask>
<ValidationMessage>Value needs to be between 1 and 31, multiple values, ranges, L (last day of month) and * are supported (ex. 1,2,8 or 1-28 )</ValidationMessage> <ValidationMessage>Value needs to be between 1 and 31; multiple values, ranges, L (last day of month), steps and asterisk are supported (ex. 1,2,8 or 1-28)</ValidationMessage>
</days> </days>
<months type="TextField"> <months type="TextField">
<default>*</default> <default>*</default>
<Required>Y</Required> <Required>Y</Required>
<mask>/^(((?:\*|[1][0-2]|0[1-9]|[1-9]|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(,{1}|-{1}|$))+)$/</mask> <mask>/^(((?:\*|[1][0-2]|0[1-9]|[1-9]|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(,{1}|-{1}|\/{1}|$))+)$/</mask>
<ValidationMessage>Value needs to be between 1 and 12 or JAN to DEC, multiple values, ranges and * are supported (ex. JAN,2,10 or 3-8 )</ValidationMessage> <ValidationMessage>Value needs to be between 1 and 12 or JAN to DEC, multiple values, ranges, steps and asterisk are supported (ex. JAN,2,10 or 3-8)</ValidationMessage>
</months> </months>
<weekdays type="TextField"> <weekdays type="TextField">
<default>*</default> <default>*</default>
<Required>Y</Required> <Required>Y</Required>
<mask>/^(((?:\*|[0-6])(,{1}|-{1}|$))+)$/</mask> <mask>/^(((?:\*|[0-7])(,{1}|-{1}|\/{1}|$))+)$/</mask>
<ValidationMessage>Value needs to be between 0 and 6 ( Sunday to Saturday), multiple values, ranges and * are supported (ex. 1,2,4 or 0-4 ) </ValidationMessage> <ValidationMessage>Value needs to be between 0 and 7 (Sunday to Sunday), multiple values, ranges, steps and asterisk are supported (ex. 1,2,4 or 0-4).</ValidationMessage>
</weekdays> </weekdays>
<who type="TextField"> <who type="TextField">
<default>root</default> <default>root</default>
......
<menu>
<System>
<Settings>
<Cron order="1000" url="/ui/cron/"/>
</Settings>
</System>
</menu>
# DO NOT EDIT THIS FILE - OPNsense auto generated file. # DO NOT EDIT THIS FILE -- OPNsense auto-generated file
# (Cron version -- $FreeBSD$)
SHELL=/bin/sh SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
# Order of crontab fields
# minute hour mday month wday command
{% if helpers.exists('OPNsense.cron.jobs') %} {% if helpers.exists('OPNsense.cron.jobs') %}
{% for job in helpers.toList('OPNsense.cron.jobs.job') %} #minute hour mday month wday command
{% for job in helpers.toList('OPNsense.cron.jobs.job') %}
# Origin/Description: {{job.origin}}/{{job.description}} # Origin/Description: {{job.origin}}/{{job.description}}
{{job.minutes}} {{job.hours}} {{job.days}} {{job.months}} {{job.weekdays}} /usr/local/sbin/configctl {{job.command}} {{job.parameter}} {{job.minutes}} {{job.hours}} {{job.days}} {{job.months}} {{job.weekdays}} /usr/local/sbin/configctl {{job.command}} {{job.parameter}}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment