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

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -