How to create a variable in crontab for a date from last week

I am trying to set up a cron job, using a script that needs to be occasionally run interactively.

So far it looks like this:

59 1 * * 1 /weekly.csh date +\%Y\%m\%d date +\%Y\%m\%d >> log

What I really want, is for the first date variable to be todays date, minus seven days (ie. last week) and the second variable to remain as is (today's date).

How can I do this??? Any help is much appreciated!!!

1

1 Answer

You can use

59 1 * * 1 /weekly.csh date +\%Y\%m\%d --date="-1 week" date +\%Y\%m\%d >> log

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