Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
26fbbb0f
Commit
26fbbb0f
authored
May 30, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cron: remove short-lived empty cron, this is better...; #911
parent
eaabe7f4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
38 deletions
+9
-38
services.inc
src/etc/inc/services.inc
+9
-33
+TARGETS
src/opnsense/service/templates/OPNsense/Cron/+TARGETS
+0
-1
empty.cron
src/opnsense/service/templates/OPNsense/Cron/empty.cron
+0
-4
No files found.
src/etc/inc/services.inc
View file @
26fbbb0f
...
...
@@ -2371,11 +2371,11 @@ function configure_cron()
$autocron
=
array
();
$autocron
[]
=
generate_cron_job
(
'/usr/local/sbin/expiretable -v -t 3600 sshlockout'
,
'*/60'
);
$autocron
[]
=
generate_cron_job
(
'/usr/local/sbin/expiretable -v -t 3600 webConfiguratorlockout'
,
'*/60'
);
$autocron
[]
=
generate_cron_job
(
'/usr/local/sbin/expiretable -v -t 3600 sshlockout'
,
'*/60'
);
$autocron
[]
=
generate_cron_job
(
'/usr/local/sbin/expiretable -v -t 3600 virusprot'
,
'*/60'
);
$autocron
[]
=
generate_cron_job
(
'/usr/local/etc/rc.dyndns.update'
,
'1'
,
'1'
);
$autocron
[]
=
generate_cron_job
(
'/usr/local/etc/rc.update_urltables'
,
'30'
,
'12'
);
$autocron
[]
=
generate_cron_job
(
'/usr/local/etc/rc.dyndns.update'
,
'1'
,
'1'
);
if
(
!
empty
(
$config
[
'system'
][
'rrdbackup'
]))
{
$autocron
[]
=
generate_cron_job
(
'/usr/local/etc/rc.backup_rrd'
,
'0'
,
'*/'
.
$config
[
'system'
][
'rrdbackup'
]);
...
...
@@ -2416,26 +2416,11 @@ function configure_cron()
break
;
}
$anchor
=
'# custom crontab entries'
;
/* preserve existing crontab entries */
$crontab_contents
=
file
(
'/etc/crontab'
,
FILE_IGNORE_NEW_LINES
|
FILE_SKIP_EMPTY_LINES
);
for
(
$i
=
0
;
$i
<
count
(
$crontab_contents
);
$i
++
)
{
$cron_item
=
&
$crontab_contents
[
$i
];
if
(
strpos
(
$cron_item
,
$anchor
)
!==
false
)
{
array_splice
(
$crontab_contents
,
$i
-
1
);
break
;
}
}
/* please maintain the newline at the end of file */
$crontab_contents
=
implode
(
"
\n
"
,
$crontab_contents
)
.
"
\n
"
;
$crontab_contents
.=
"#
\n
"
;
$crontab_contents
.=
$anchor
.
"
\n
"
;
$crontab_contents
.=
'# auto-generated at '
.
date
(
'F j, Y, g:i a'
)
.
"
\n
"
;
$crontab_contents
.=
"#
\n
"
;
$crontab_contents
=
"# DO NOT EDIT THIS FILE -- OPNsense auto-generated file
\n
"
;
$crontab_contents
.=
"# Please use /etc/crontab for your overrides instead.
\n
"
;
$crontab_contents
.=
"SHELL=/bin/sh
\n
"
;
$crontab_contents
.=
"PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
\n
"
;
$crontab_contents
.=
"#minute
\t
hour
\t
mday
\t
month
\t
wday
\t
command
\n
"
;
foreach
(
$autocron
as
$item
)
{
$crontab_contents
.=
"
{
$item
[
'minute'
]
}
\t
"
;
...
...
@@ -2443,22 +2428,14 @@ function configure_cron()
$crontab_contents
.=
"
{
$item
[
'mday'
]
}
\t
"
;
$crontab_contents
.=
"
{
$item
[
'month'
]
}
\t
"
;
$crontab_contents
.=
"
{
$item
[
'wday'
]
}
\t
"
;
$crontab_contents
.=
"
{
$item
[
'who'
]
}
\t
"
;
$crontab_contents
.=
"
{
$item
[
'command'
]
}
\n
"
;
}
$crontab_contents
.=
"#
\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
"
;
file_put_contents
(
'/etc/crontab'
,
$crontab_contents
);
unset
(
$crontab_contents
);
file_put_contents
(
'/var/cron/tabs/root'
,
$crontab_contents
);
killbypid
(
'/var/run/cron.pid'
,
'HUP'
);
}
function
generate_cron_job
(
$command
,
$minute
=
'0'
,
$hour
=
'*'
,
$monthday
=
'*'
,
$month
=
'*'
,
$weekday
=
'*'
,
$who
=
'root'
)
function
generate_cron_job
(
$command
,
$minute
=
'0'
,
$hour
=
'*'
,
$monthday
=
'*'
,
$month
=
'*'
,
$weekday
=
'*'
)
{
$cron_item
=
array
();
...
...
@@ -2467,7 +2444,6 @@ function generate_cron_job($command, $minute = '0', $hour = '*', $monthday = '*'
$cron_item
[
'mday'
]
=
$monthday
;
$cron_item
[
'month'
]
=
$month
;
$cron_item
[
'wday'
]
=
$weekday
;
$cron_item
[
'who'
]
=
$who
;
$cron_item
[
'command'
]
=
$command
;
return
$cron_item
;
...
...
src/opnsense/service/templates/OPNsense/Cron/+TARGETS
View file @
26fbbb0f
empty.cron:/var/cron/tabs/root
user.cron:/var/cron/tabs/nobody
src/opnsense/service/templates/OPNsense/Cron/empty.cron
deleted
100644 → 0
View file @
eaabe7f4
# DO NOT EDIT THIS FILE -- OPNsense auto-generated file
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
# This file is empty on purpose, use /etc/crontab for overrides
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment