Running cron job on every Monday, Wednesday & Friday of a week

I want to know how I can create a cron job to run a .sh file automatically on every Monday, Wednesday & Friday @ night 12 am USA PST?

1

2 Answers

It can be done in one line too

0 0 0 0 1,3,5 /pathofscript/

Create THREE cron table entries, one running your script Monday at 0000, one running it Wednesday at 0000, and one running it Friday at 0000. Or schedule script execution for 0000 EVERY day, and have the script exit quietly on Tuesday, Thursday, Saturday and Sunday.

Remember that the "Cron environment" differs from your current environment (different $PATH, $DISPLAY not defined, possible different execution path in ~/.bashrc, ...). Read man 8 cron;man 5 crontab. Initially log start/stop messages to a directory you know exists, like /tmp. If you are not logged in at 0000 M,W,F, your encrypted HOME directory will not be available.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like