linux - How to write PHP script for cronjob that uses cat /dev/null > to reset log files -
i use assistance in making php script add cronjob include multiple, (10 15), commands such as:
line1: cat /dev/null > /var/www/vhosts/website.com /logs/access_log.webstat line2: cat /dev/null > /var/www/vhosts/website.com/logs/big_access_log line3: cat /dev/null > /var/log/plesk-roundcube/largefile.log and on. commands work great command line, doing daily time consuming , files grow way large though being rotated. assistance appreciated, thank you.
could possibly use shell_exec command complete these actions:
example:
<?php $output = shell_exec('cat /dev/null > /var/www/vhosts/website.com /logs/access_log.webstat'); echo "<pre>$output</pre>"; ?> then create cron job run them @ interval times.
Comments
Post a Comment