2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by sknake
0

Sure. Post the cron line you're using. Please use code tags when posting codes on daniweb:

[code=text] ...cron here...

[/code]

Edited by sknake: n/a

0

Hi,

This is what is I am using

30 00 1-7 * * [ "$(date '+%a')" == "Mon" ] ksh /u/dolfin/bin/run_avg_cogs.sh >> /u/dolfin/log/run_avg_cogs.LOG 2>&1

Thanks!!

Edited by happygeek: fixed formatting

1

Does that ever run? I would put your evaluation in an external script and call that script from cron.

Install this in your crontab:

0 0 0 * 1 ksh /u/dolfin/bin/run_avg_cogs_datetest.sh

Then create the new file run_avg_cogs_datetest.sh :

#! /usr/bin/ksh
day=$(date +%d)
if ((day <= 7)) ; then
   exec /u/dolfin/bin/run_avg_cogs.sh >> /u/dolfin/log/run_avg_cogs.LOG 2>&1
fi
exit 1

The cron job runs every every monday of the month, but your script only executes if its within the first 7 days of the month. So effectively the first monday of every month.

Borrowed from:
http://www.unix.com/unix-dummies-questions-answers/2551-crontab-first-monday-month-only.html

Edited by sknake: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.