Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cronlog-viewer
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
Container Registry
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
IML Open Source
Cronlog-viewer
Commits
347e2834
Commit
347e2834
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
add running jobs
parent
28ab961b
No related branches found
No related tags found
1 merge request
!13
add running jobs
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
classes/cronlog-renderer.class.php
+3
-3
3 additions, 3 deletions
classes/cronlog-renderer.class.php
classes/cronlog.class.php
+27
-7
27 additions, 7 deletions
classes/cronlog.class.php
with
30 additions
and
10 deletions
classes/cronlog-renderer.class.php
+
3
−
3
View file @
347e2834
...
...
@@ -111,7 +111,7 @@ class cronlogrenderer extends cronlog{
$sHtml
=
''
;
if
(
!
$aData
){
$aData
=
$this
->
getServersLastLog
();
$aData
=
array_merge
(
$this
->
getRunningJobs
(),
$this
->
getServersLastLog
()
)
;
}
$sTblHead
=
''
;
$iOK
=
0
;
...
...
@@ -201,7 +201,7 @@ class cronlogrenderer extends cronlog{
}
$sColStatus
=
'<ul>'
.
$sColStatus
.
'</ul>'
;
}
else
{
$sColStatus
.
=
$this
->
t
(
'status-ok'
);
$sColStatus
.
=
(
$aEntry
[
'SCRIPTRC'
]
?
$this
->
t
(
'status-ok'
)
:
''
)
;
}
// render table of last logfile per cron job
$sHtml
.
=
'<tr onclick="showFile(\''
.
$aEntry
[
'logfile'
]
.
'\');" title="'
.
sprintf
(
$this
->
t
(
'row-click-show-logfile'
),
$aEntry
[
'logfile'
])
.
'">'
...
...
@@ -224,7 +224,7 @@ class cronlogrenderer extends cronlog{
.
$sTtlHr
.
'</td>'
.
'<td class="'
.
(
$aEntry
[
'SCRIPTRC'
]
>
0
?
'message-error'
:
'message-ok'
)
.
'">'
.
$aEntry
[
'SCRIPTRC'
]
.
(
$aEntry
[
'SCRIPTRC'
]
?
$aEntry
[
'SCRIPTRC'
]
:
'⏳'
)
.
'</td>'
.
'<td class="'
.
(
$iNextRunWarn
<
date
(
"U"
)
?
(
$iNextRunErr
<
date
(
"U"
)
?
'message-error'
:
'message-warning'
)
...
...
This diff is collapsed.
Click to expand it.
classes/cronlog.class.php
+
27
−
7
View file @
347e2834
...
...
@@ -53,7 +53,8 @@ class cronlog {
protected
$_sActiveServer
=
false
;
protected
$_sFileFilter_serverjoblog
=
'*joblog*.done'
;
protected
$_sFileFilter_serverlog
=
'*.log'
;
protected
$_sFileFilter_joblog
=
'*.log'
;
protected
$_sFileFilter_jobrunning
=
'*.log.running'
;
protected
$_sLang
=
''
;
// language ... read from config file
protected
$_aLang
=
[];
// language data
...
...
@@ -101,7 +102,7 @@ class cronlog {
/**
* chaching: get the full path of directory for caching
* @return
type
* @return
string
*/
protected
function
_getCacheDir
(){
return
$this
->
_sDataDir
.
'/__cache'
;
...
...
@@ -109,8 +110,8 @@ class cronlog {
/**
* caching: get full path of a caching item
* @param
type
$sTaskId
* @return
type
* @param
string
$sTaskId
* @return
string
*/
protected
function
_getCacheFile
(
$sTaskId
){
return
$this
->
_getCacheDir
()
.
'/'
.
$sTaskId
;
...
...
@@ -118,7 +119,7 @@ class cronlog {
/**
* read logs: get full path to a servers cronjob logdata
* @return
type
* @return
string
*/
protected
function
_getServerlogDir
(){
return
$this
->
_sDataDir
.
'/'
.
$this
->
_sActiveServer
;
...
...
@@ -127,7 +128,7 @@ class cronlog {
/**
* caching: get cached data if they exist and aren't expired
* @param string $sTaskId
* @return boolean|array
* @return
mixed
boolean|array
*/
protected
function
_getCacheData
(
$sTaskId
){
// DISABLE CACHE return false;
...
...
@@ -298,7 +299,24 @@ class cronlog {
public
function
getServersLastLog
(){
$aReturn
=
array
();
$aData
=
array
();
foreach
(
glob
(
$this
->
_getServerlogDir
()
.
'/'
.
$this
->
_sFileFilter_serverlog
)
as
$sMyJobfile
){
foreach
(
glob
(
$this
->
_getServerlogDir
()
.
'/'
.
$this
->
_sFileFilter_joblog
)
as
$sMyJobfile
){
// echo "DEBUG: log file $sMyJobfile<br>";
$aData
=
$this
->
_parseLogfile
(
$sMyJobfile
);
$aData
[
'server'
]
=
$this
->
_sActiveServer
;
$aData
[
'logfile'
]
=
$this
->
_sActiveServer
.
'/'
.
basename
(
$sMyJobfile
);
$aReturn
[
$aData
[
'SCRIPTSTARTTIME'
]
.
$sMyJobfile
]
=
$aData
;
}
rsort
(
$aReturn
);
return
$aReturn
;
}
/**
* get logs from jobfilea of the current or given server
* @return array
*/
public
function
getRunningJobs
(){
$aReturn
=
array
();
$aData
=
array
();
foreach
(
glob
(
$this
->
_getServerlogDir
()
.
'/'
.
$this
->
_sFileFilter_jobrunning
)
as
$sMyJobfile
){
// echo "DEBUG: log file $sMyJobfile<br>";
$aData
=
$this
->
_parseLogfile
(
$sMyJobfile
);
$aData
[
'server'
]
=
$this
->
_sActiveServer
;
...
...
@@ -311,6 +329,8 @@ class cronlog {
/**
* translate ... get a language specific text of a given key
* @param string $id id of language text
* @return string
*/
public
function
t
(
$id
){
return
''
...
...
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