crontab support

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
were55

Re: crontab support

Post by were55 »

Hi Kymru,

I'm putting some lines to delete files and update xml graber, this is a crontab -l (deleted fist lines):
2 09,21 * * * /usr/bin/find /home/download/TV -mtime +2 -print0|xargs -0 /bin/rm -rf >> /home/tmp/delete_files.log 2>&1
5 14,21 * * * /usr/bin/find /home/download/movies -mtime +2 -print0|xargs -0 /bin/rm -rf >> /home/tmp/delete_files.log 2>&1
# 8 09,21 * * * /usr/bin/find /root/.config/deluge/state/*.torrent -mtime +2 -print0|xargs -0 /bin/rm -rf >> /tmp/delete_files.log 2>&1
# @reboot /usr/bin/startweaved.sh
01 1,5,9,13,17,21 * * * /root/wg++/update.sh
(/home/tmp/ exist, but delete_files.log is 0 size.)

if I run any of this lines manually, they are executed without problems, also cron job is running:
root@DietPi:~/wg++# ps -ef|grep cron
root 941 1 0 11:55 ? 00:00:00 /usr/sbin/cron -f
root 4085 3327 0 12:05 pts/0 00:00:00 grep cron
Thanks
Kymru
Posts: 30
Joined: Wed Jan 25, 2017 6:40 pm

Re: crontab support

Post by Kymru »

were55 wrote: 2 09,21 * * * /usr/bin/find /home/download/TV -mtime +2 -print0|xargs -0 /bin/rm -rf >> /home/tmp/delete_files.log 2>&1
5 14,21 * * * /usr/bin/find /home/download/movies -mtime +2 -print0|xargs -0 /bin/rm -rf >> /home/tmp/delete_files.log 2>&1
# 8 09,21 * * * /usr/bin/find /root/.config/deluge/state/*.torrent -mtime +2 -print0 | xargs -0 /bin/rm -rf >> /tmp/delete_files.log 2>&1
# @reboot /usr/bin/startweaved.sh
01 1,5,9,13,17,21 * * * /root/wg++/update.sh
2 9,21 * * * /usr/bin/find /home/download/TV -mmin +2 -print0 | xargs -0 /bin/rm -rf >> /home/tmp/delete_files.log 2>&1
5 14,21 * * * /usr/bin/find /home/download/movies -mmin +2 -print0 | xargs -0 /bin/rm -rf >> /home/tmp/delete_files.log 2>&1
# 8 9,21 * * * /usr/bin/find /root/.config/deluge/state/*.torrent -mmin +2 -print0 | xargs -0 /bin/rm -rf >> /tmp/delete_files.log 2>&1
# @reboot /usr/bin/startweaved.sh
1 1,5,9,13,17,21 * * * /root/wg++/update.sh


-mtime +2 is for 2 days and older yet you are running the cron daily
9.02am and 9.02pm
2.05pm and 9.05pm
9.08am and 9.08pm

-mmin is used for minutes

you can also drop the 0 from 2 09,21 and 8 09,21 and 01 1,5,9....
were55

Re: crontab support

Post by were55 »

Hi Kymru,

first at all, thanks for your help, really appreciate it. I know I'm running the script to review the files older than 2 days, this is not the problem. The crontab is not running, even the other line "01 1,5,9,13,17,21 * * * /root/wg++/update.sh" (execute script every 4 hours), I can restart the process but is the same, not sure if I can review some log.

thanks

UPDATE
I re-write the cron file and now is working, maybe some character was there. Thanks for your help ;)
Post Reply