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."
/usr/local/etc/rc.opnsense start
# 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
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
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
......
<?php
/**
* Copyright (C) 2015 Deciso B.V.
*
......@@ -26,6 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Cron\Api;
use \OPNsense\Base\ApiControllerBase;
......
<?php
/**
* Copyright (C) 2015 Deciso B.V.
*
......@@ -26,6 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Cron\Api;
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
/**
* Copyright (C) 2015 Deciso B.V.
*
......@@ -26,6 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Cron;
use OPNsense\Base\BaseModel;
......
<model>
<mount>//OPNsense/cron</mount>
<description>
(minicron) cron settings
</description>
<description>Cron settings</description>
<items>
<jobs>
<job type="ArrayField">
......@@ -18,32 +16,32 @@
<minutes type="TextField">
<default>0</default>
<Required>Y</Required>
<mask>/^((?:\*|[1-5][0-9]|0[0-9]|[0-9])(,{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>
<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, steps and asterisk are supported (ex. 1,10,20,30 or 1-30)</ValidationMessage>
</minutes>
<hours type="TextField">
<default>0</default>
<Required>Y</Required>
<mask>/^((?:\*|([1][0-9]|[2][0-3])|0[0-9]|[0-9])(,{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>
<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, steps and asterisk are supported (ex. 1,2,8 or 0-8)</ValidationMessage>
</hours>
<days type="TextField">
<default>*</default>
<Required>Y</Required>
<mask>/^(((?:\*|[1-2][0-9]|0[1-9]|[1-9]|[3][0-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>
<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), steps and asterisk are supported (ex. 1,2,8 or 1-28)</ValidationMessage>
</days>
<months type="TextField">
<default>*</default>
<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>
<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>
<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, steps and asterisk are supported (ex. JAN,2,10 or 3-8)</ValidationMessage>
</months>
<weekdays type="TextField">
<default>*</default>
<Required>Y</Required>
<mask>/^(((?:\*|[0-6])(,{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>
<mask>/^(((?:\*|[0-7])(,{1}|-{1}|\/{1}|$))+)$/</mask>
<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>
<who type="TextField">
<default>root</default>
......
<menu>
<System>
<Settings>
<Cron order="1000" url="/ui/cron/"/>
</Settings>
</System>
</menu>
# DO NOT EDIT THIS FILE - OPNsense auto generated file.
# (Cron version -- $FreeBSD$)
# DO NOT EDIT THIS FILE -- OPNsense auto-generated file
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
# Order of crontab fields
# minute hour mday month wday command
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
{% 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}}
{{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 %}
{% 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