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
5d80d462
Commit
5d80d462
authored
Apr 25, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cron: remove custom install hook; #911
parent
5a10f56a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
47 deletions
+22
-47
services.inc
src/etc/inc/services.inc
+22
-47
No files found.
src/etc/inc/services.inc
View file @
5d80d462
...
...
@@ -2354,12 +2354,28 @@ function configure_cron()
'newsyslog'
,
/* old config migration for extra care */
);
foreach
(
$obsoletes
as
$obsolete
)
{
/*
* Strip old cron jobs that we no longer save explicitly.
* This can be safely removed on our final road to 17.1.
*/
install_cron_job
(
$obsolete
,
false
);
/*
* Strip old cron jobs that we no longer save explicitly.
* This can be safely removed on our final road to 17.1.
*/
if
(
isset
(
$config
[
'cron'
][
'item'
]))
{
foreach
(
$obsoletes
as
$obsolete
)
{
$is_installed
=
false
;
$x
=
0
;
foreach
(
$config
[
'cron'
][
'item'
]
as
$item
)
{
if
(
strstr
(
$item
[
'command'
],
$obsolete
))
{
$is_installed
=
true
;
break
;
}
$x
++
;
}
if
(
$is_installed
==
true
)
{
unset
(
$config
[
'cron'
][
'item'
][
$x
]);
write_config
(
sprintf
(
gettext
(
'Removed cron job for %s'
),
$obsolete
));
}
}
}
$autocron
=
array
();
...
...
@@ -2453,47 +2469,6 @@ function generate_cron_job($command, $minute = '0', $hour = '*', $monthday = '*'
return
$cron_item
;
}
function
install_cron_job
(
$command
,
$active
=
false
,
$minute
=
"0"
,
$hour
=
"*"
,
$monthday
=
"*"
,
$month
=
"*"
,
$weekday
=
"*"
,
$who
=
"root"
)
{
global
$config
;
$is_installed
=
false
;
if
(
!
is_array
(
$config
[
'cron'
]))
{
$config
[
'cron'
]
=
array
();
}
if
(
!
is_array
(
$config
[
'cron'
][
'item'
]))
{
$config
[
'cron'
][
'item'
]
=
array
();
}
$x
=
0
;
foreach
(
$config
[
'cron'
][
'item'
]
as
$item
)
{
if
(
strstr
(
$item
[
'command'
],
$command
))
{
$is_installed
=
true
;
break
;
}
$x
++
;
}
if
(
$active
)
{
$cron_item
=
generate_cron_job
(
$command
,
$minute
,
$hour
,
$monthday
,
$month
,
$weekday
,
$who
);
if
(
!
$is_installed
)
{
$config
[
'cron'
][
'item'
][]
=
$cron_item
;
write_config
(
sprintf
(
gettext
(
"Installed cron job for %s"
),
$command
));
}
else
{
$config
[
'cron'
][
'item'
][
$x
]
=
$cron_item
;
write_config
(
sprintf
(
gettext
(
"Updated cron job for %s"
),
$command
));
}
}
else
{
if
(
$is_installed
==
true
)
{
unset
(
$config
[
'cron'
][
'item'
][
$x
]);
write_config
(
sprintf
(
gettext
(
"Removed cron job for %s"
),
$command
));
}
}
}
/**
* check if apinger service is enabled
*/
function
is_apinger_enabled
()
{
global
$config
;
...
...
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