SOLVED Cron Job execute curl only if file has been modified

nrcjea001

Registered
Nov 17, 2018
2
0
1
Mauritius
cPanel Access Level
Website Owner
Hi

I need to execute a command in cron job, but only if a file has been touched. Currently, my cron command is: curl "..." where "..." is my target link. I am new to this but I did manage to find something online. Hoping that someone with experience can confirm that the command below is correct:

PHP:
usr/local/bin/php [/tmp/.lastupdate -nt /my_dir_name/my_filename ] || (curl "https://...index.php?controller..." ; touch /tmp/.lastupdate)
Thank You.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,226
463
Hi @nrcjea001,

I'm glad to see you were able to find a cron job command that worked for what you needed. Thanks for sharing the outcome!
 
  • Like
Reactions: nrcjea001