Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ISPConfig 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ISPConfig
ISPConfig 3
Commits
a2199317
Commit
a2199317
authored
4 years ago
by
Till Brehm
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Improved cron debug script"
This reverts commit
b34b1ad5
. Fixes
#5657
parent
0aa4f2de
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/cron_debug.php
+5
-22
5 additions, 22 deletions
server/cron_debug.php
with
5 additions
and
22 deletions
server/cron_debug.php
+
5
−
22
View file @
a2199317
...
...
@@ -39,25 +39,20 @@ ini_set('error_reporting', E_ALL & ~E_NOTICE);
$conf
[
'server_id'
]
=
intval
(
$conf
[
'server_id'
]);
// Load required base-classes
$app
->
uses
(
'ini_parser,file,services,getconf,system,cron,functions'
);
$app
->
uses
(
'
modules,plugins,
ini_parser,file,services,getconf,system,cron,functions'
);
$app
->
load
(
'libdatetime,cronjob'
);
// Path settings
$path
=
SCRIPT_PATH
.
'/lib/classes/cron.d'
;
//** Get commandline options
$cmd_opt
=
getopt
(
''
,
array
(
'cronjob::'
,
'force'
,
'firstrun'
));
$cmd_opt
=
getopt
(
''
,
array
(
'cronjob::'
));
if
(
isset
(
$cmd_opt
[
'cronjob'
])
&&
is_file
(
$path
.
'/'
.
$cmd_opt
[
'cronjob'
]))
{
// Cronjob that shell be run
$cronjob_file
=
$cmd_opt
[
'cronjob'
];
}
else
{
echo
"Usage example: php cron_debug.php --cronjob=100-mailbox_stats.inc.php [--force] [--firstrun]
\n
"
;
echo
"Available cronjobs:
\n
"
;
foreach
(
glob
(
$path
.
'/*-*.inc.php'
)
as
$cronjob
)
{
echo
basename
(
$cronjob
)
.
"
\n
"
;
}
die
();
die
(
'Usage example: php cron_debug.php --cronjob=100-mailbox_stats.inc.php'
);
}
// Load and run the cronjob
...
...
@@ -66,20 +61,8 @@ if(preg_match('/^\d+\-(.*)$/', $name, $match)) $name = $match[1]; // strip numer
include
$path
.
'/'
.
$cronjob_file
;
$class_name
=
'cronjob_'
.
$name
;
$cronjob
=
new
$class_name
();
if
(
isset
(
$cmd_opt
[
'force'
]))
{
$app
->
db
->
query
(
"UPDATE `sys_cron` SET `running` = 0 WHERE `name` = ?"
,
$class_name
);
}
$cronjob
->
onPrepare
();
$cronjob
->
onBeforeRun
(
isset
(
$cmd_opt
[
'firstrun'
]));
if
(
!
$cronjob
->
isRunning
())
{
$app
->
db
->
query
(
"UPDATE `sys_cron` SET `running` = ? WHERE `name` = ?"
,
(
$cronjob
->
canBeRunInParallel
()
!==
true
?
"1"
:
"0"
),
$class_name
);
$cronjob
->
onRunJob
();
$cronjob
->
onAfterRun
();
$cronjob
->
onCompleted
();
}
$cronjob
->
run
(
true
);
die
(
"finished.
\n
"
);
?>
\ No newline at end of file
?>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment