Information: Forum is in read-only mode
For details and other support options see https://www.adiscon.com/news/support-forum-set-to-read-only-mode/

Running a cron job to purge old logs

General discussions here

Moderator: alorbach

Google Ads


Running a cron job to purge old logs

Postby Callahan » Sat Aug 23, 2014 11:22 pm

I can run the following from a command line:
Code: Select all
php /var/www/html/cron/maintenance.php cleandata 1 olderthan 10

and it will purge entries from the log file.

If I create a cron job through Webmin and run it as root from Webmin to test it, I get the following error:
Code: Select all
PHP Warning:  include_once(./../include/functions_common.php): failed to open stream: No such file or directory in /var/www/html/cron/maintenance.php on line 39
PHP Warning:  include_once(): Failed opening './../include/functions_common.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/cron/maintenance.php on line 39
PHP Warning:  include_once(./../include/functions_frontendhelpers.php): failed to open stream: No such file or directory in /var/www/html/cron/maintenance.php on line 40
PHP Warning:  include_once(): Failed opening './../include/functions_frontendhelpers.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/cron/maintenance.php on line 40
PHP Fatal error:  Call to undefined function InitPhpLogCon() in /var/www/html/cron/maintenance.php on line 46


Can't figure out why, if it works from the command line then I can't see why it won't run as a cron job.

Any ideas?

Thanks.

EDIT: Found the solution. You need to make a script containing:
Code: Select all
cd /var/www/html/cron
php maintenance.php cleandata 1 olderthan 10

and run that through a cron job.
Callahan
New
 
Posts: 2
Joined: Sat Aug 23, 2014 10:53 pm

Urgent Question?

  • Pulling out your Hair?
  • Wasting Time and Money?
  • Deadline Approaching?

Google Ads


Return to General

Who is online

Users browsing this forum: No registered users and 0 guests

cron