Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
lolo888
ISPConfig 3
Commits
641cb3bc
Commit
641cb3bc
authored
Dec 21, 2008
by
redray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cron errors got to logfile now and are available in monitor-section
parent
70cc7d0f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
6 deletions
+64
-6
install/lib/installer_base.lib.php
install/lib/installer_base.lib.php
+11
-3
interface/web/monitor/lib/lang/en.lng
interface/web/monitor/lib/lang/en.lng
+1
-0
interface/web/monitor/lib/module.conf.php
interface/web/monitor/lib/module.conf.php
+4
-0
interface/web/monitor/show_log.php
interface/web/monitor/show_log.php
+4
-0
server/cron_daily.php
server/cron_daily.php
+3
-3
server/mods-available/monitor_core_module.inc.php
server/mods-available/monitor_core_module.inc.php
+41
-0
No files found.
install/lib/installer_base.lib.php
View file @
641cb3bc
...
...
@@ -1042,9 +1042,12 @@ class installer_base {
if
(
stristr
(
$val
,
'/usr/local/ispconfig'
))
unset
(
$existing_root_cron_jobs
[
$key
]);
}
// Crontab must end with an empty line or comment!
$root_cron_jobs
=
array
(
'* * * * * /usr/local/ispconfig/server/server.sh > /dev/null'
,
'30 00 * * * /usr/local/ispconfig/server/cron_daily.sh > /dev/null'
'# --- ISPConfig ----'
,
'* * * * * /usr/local/ispconfig/server/server.sh > /dev/null 2>> /var/log/var/log/ispconfig/cron.log'
,
'30 00 * * * /usr/local/ispconfig/server/cron_daily.sh > /dev/null 2>> /var/log/var/log/ispconfig/cron.log'
,
'# ------------------'
);
foreach
(
$root_cron_jobs
as
$cron_job
)
{
if
(
!
in_array
(
$cron_job
.
"
\n
"
,
$existing_root_cron_jobs
))
{
...
...
@@ -1061,7 +1064,12 @@ class installer_base {
exec
(
'crontab -u getmail -l > crontab.txt'
);
$existing_cron_jobs
=
file
(
'crontab.txt'
);
$cron_jobs
=
array
(
'*/5 * * * * '
.
$cf
[
'program'
]
.
' -g '
.
$cf
[
'config_dir'
]
.
' -r '
.
$cf
[
'config_dir'
]
.
'/*.conf > /dev/null'
);
// Crontab must end with an empty line or comment!
$cron_jobs
=
array
(
'# --- ISPConfig ----'
,
'*/5 * * * * '
.
$cf
[
'program'
]
.
' -g '
.
$cf
[
'config_dir'
]
.
' -r '
.
$cf
[
'config_dir'
]
.
'/*.conf > /dev/null 2>> /var/log/var/log/ispconfig/cron.log'
,
'# ------------------'
);
// remove existing ispconfig cronjobs, in case the syntax has changed
foreach
(
$cron_jobs
as
$key
=>
$val
)
{
...
...
interface/web/monitor/lib/lang/en.lng
View file @
641cb3bc
...
...
@@ -35,6 +35,7 @@ $wb['Show Mail-Log'] = 'Show Mail-Log';
$wb
[
'Show Mail warn-Log'
]
=
'Show Mail warn-Log'
;
$wb
[
'Show Mail err-Log'
]
=
'Show Mail err-Log'
;
$wb
[
'Show System-Log'
]
=
'Show System-Log'
;
$wb
[
'Show ISPC Cron-Log'
]
=
'Show ISPC Cron-Log'
;
$wb
[
'Show Freshclam-Log'
]
=
'Show Freshclam-Log'
;
$wb
[
'Show Clamav-Log'
]
=
'Show Clamav-Log'
;
$wb
[
'Show ISPConfig-Log'
]
=
'Show ISPConfig-Log'
;
...
...
interface/web/monitor/lib/module.conf.php
View file @
641cb3bc
...
...
@@ -134,6 +134,10 @@ $items[] = array( 'title' => "Show System-Log",
'target'
=>
'content'
,
'link'
=>
'monitor/show_log.php?log=log_messages'
);
$items
[]
=
array
(
'title'
=>
"Show ISPC Cron-Log"
,
'target'
=>
'content'
,
'link'
=>
'monitor/show_log.php?log=log_ispc_cron'
);
$items
[]
=
array
(
'title'
=>
"Show Freshclam-Log"
,
'target'
=>
'content'
,
'link'
=>
'monitor/show_log.php?log=log_freshclam'
);
...
...
interface/web/monitor/show_log.php
View file @
641cb3bc
...
...
@@ -64,6 +64,10 @@ switch($logParam) {
$logId
=
'log_messages'
;
$title
=
'System (Server: '
.
$_SESSION
[
'monitor'
][
'server_name'
]
.
')'
;
break
;
case
'log_ispc_cron'
:
$logId
=
'log_ispc_cron'
;
$title
=
'System (Server: '
.
$_SESSION
[
'monitor'
][
'server_name'
]
.
')'
;
break
;
case
'log_freshclam'
:
$logId
=
'log_freshclam'
;
$title
=
'Freshclam - Log (Server: '
.
$_SESSION
[
'monitor'
][
'server_name'
]
.
')'
;
...
...
server/cron_daily.php
View file @
641cb3bc
...
...
@@ -91,7 +91,7 @@ foreach($records as $rec) {
$sql
=
"SELECT domain_id, domain, document_root FROM web_domain WHERE server_id = "
.
$conf
[
"server_id"
];
$records
=
$app
->
db
->
queryAllRecords
(
$sql
);
foreach
(
$records
as
$rec
)
{
$yesterday
=
date
(
"md
Y
"
,
time
()
-
86400
);
$yesterday
=
date
(
"
Y
md"
,
time
()
-
86400
);
$logfile
=
escapeshellcmd
(
$rec
[
"document_root"
]
.
'/log/'
.
$yesterday
.
'-access.log'
);
if
(
@
is_file
(
$logfile
))
{
$domain
=
escapeshellcmd
(
$rec
[
"domain"
]);
...
...
@@ -110,7 +110,7 @@ foreach($records as $rec) {
$sql
=
"SELECT domain_id, domain, document_root FROM web_domain WHERE server_id = "
.
$conf
[
"server_id"
];
$records
=
$app
->
db
->
queryAllRecords
(
$sql
);
foreach
(
$records
as
$rec
)
{
$yesterday
=
date
(
"md
Y
"
,
time
()
-
86400
);
$yesterday
=
date
(
"
Y
md"
,
time
()
-
86400
);
$logfile
=
escapeshellcmd
(
$rec
[
"document_root"
]
.
'/log/'
.
$yesterday
.
'-access.log'
);
if
(
@
is_file
(
$logfile
))
{
// Compress yesterdays logfile
...
...
@@ -118,7 +118,7 @@ foreach($records as $rec) {
}
// delete logfiles after 30 days
$month_ago
=
date
(
"md
Y
"
,
time
()
-
86400
*
30
);
$month_ago
=
date
(
"
Y
md"
,
time
()
-
86400
*
30
);
$logfile
=
escapeshellcmd
(
$rec
[
"document_root"
]
.
'/log/'
.
$yesterday
.
'-access.log.gz'
);
if
(
@
is_file
(
$logfile
))
{
unlink
(
$logfile
);
...
...
server/mods-available/monitor_core_module.inc.php
View file @
641cb3bc
...
...
@@ -113,6 +113,7 @@ class monitor_core_module {
$this
->
monitorMailWarnLog
();
$this
->
monitorMailErrLog
();
$this
->
monitorMessagesLog
();
$this
->
monitorISPCCronLog
();
$this
->
monitorFreshClamLog
();
$this
->
monitorClamAvLog
();
$this
->
monitorIspConfigLog
();
...
...
@@ -937,6 +938,43 @@ function monitorMailLog()
$this
->
_delOldRecords
(
$type
,
10
);
}
function
monitorISPCCronLog
()
{
global
$app
;
global
$conf
;
/* the id of the server as int */
$server_id
=
intval
(
$conf
[
"server_id"
]);
/** The type of the data */
$type
=
'log_ispc_cron'
;
/* Get the data of the log */
$data
=
$this
->
_getLogData
(
$type
);
/*
* actually this info has no state.
* maybe someone knows better...???...
*/
$state
=
'no_state'
;
/*
Insert the data into the database
*/
$sql
=
"INSERT INTO monitor_data (server_id, type, created, data, state) "
.
"VALUES ("
.
$server_id
.
", "
.
"'"
.
$app
->
dbmaster
->
quote
(
$type
)
.
"', "
.
time
()
.
", "
.
"'"
.
$app
->
dbmaster
->
quote
(
serialize
(
$data
))
.
"', "
.
"'"
.
$state
.
"'"
.
")"
;
$app
->
dbmaster
->
query
(
$sql
);
/* The new data is written, now we can delete the old one */
$this
->
_delOldRecords
(
$type
,
10
);
}
function
monitorFreshClamLog
()
{
global
$app
;
...
...
@@ -1092,6 +1130,9 @@ function monitorMailLog()
case
'log_messages'
:
$logfile
=
'/var/log/messages'
;
break
;
case
'log_ispc_cron'
:
$logfile
=
'/var/log/ispconfig/cron.log'
;
break
;
case
'log_freshclam'
:
$logfile
=
'/var/log/clamav/freshclam.log'
;
break
;
...
...
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