?
Solved

Crontab timing

Posted on 2006-04-30
5
Medium Priority
?
332 Views
Last Modified: 2013-12-16
Hello,
Is it a any way to say last sunday in each month?

Thanks
0
Comment
Question by:Aida2
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:slow1000
ID: 16575202
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16575398
42 22 * * * if [ `env TZ=$TZ-24 date +%a` == "Sun" ]; then my-script; fi
0
 
LVL 1

Author Comment

by:Aida2
ID: 16576003
Thanks a lot .
Can you please tell me what TZ=$TZ-24 do
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 16577032
> what TZ=$TZ-24 do
sets the date to tomorrow

oops, just seen that I posted the wrong solution, use something like this

42 22 22-31 * * [ `/usr/bin/cal|/usr/bin/awk '/^[23]/{s=$1}END{print s}'` = `date +%d` ] && my-script; fi
0
 
LVL 1

Author Comment

by:Aida2
ID: 16577111
Thanks it's work
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Fine Tune your automatic Updates for Ubuntu / Debian
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question