Quantcast
Channel: MX Linux Forum
Viewing all articles
Browse latest Browse all 4123

Software / Configuration • Re: Examples to make "crontab" work

$
0
0
You are not providing any reference to where that command is... cron wants specific paths or needs an environment to load ( like bash etc)

Example: if your running script from your ~/scripts folder... you would need to provide the ~/scripts or complete path. ( I always provide full path.)


*/3 * * * * /home/me/scripts/SVN_AutoUpdate.sh >> /home/me/scripts/SVN_AutoUpdate_cron.log 2>&1

The above
- runs the SVN_AutoUpdate.sh script located in my scripts folder
- Logs what cron does in that SVN_AutoUpdate_cron.log
- and passes anything else along into the scripts log ( the 2>&1 ) part.

You should read up on how its all done, there are MANY ways to do things;

https://linuxhandbook.com/crontab/

https://linuxconfig.org/using-cron-sche ... ux-systems

Edit: also, there is an entire structure of cron under /etc/cron.d/ in MX .. If you want to run jobs as say sudo, you can run from there too. (I find this far easier to run say TimeShift at a specific time. )

Exp: I have a timeshift script which runs timeshift, then verifies that it all ran ok, and then emails me that it completed - or failed. I never got this to run correctly in crontab .. but it works perfectly from this other location. ( And my cleanup scripts run better here too.)

Statistics: Posted by CharlesV — Wed Dec 27, 2023 9:09 pm



Viewing all articles
Browse latest Browse all 4123

Trending Articles