crontab:run a bash script every day

1- create bash scrip

nano /etc/log/logscriptdaily.sh
  cp /var/log/corerouter.log corerouter.log.$(date +\%F)
  cat /dev/null > /var/log/corerouter.log
chmod a+x logscriptdaily.sh

2-edit crontab

crontab -e
0 0 * * * /var/log/logscriptdaily.log

 

Leave a Reply

Your email address will not be published. Required fields are marked *