Solved

Checking if today is the first Monday of the month

Posted on 2004-08-02
3
356 Views
Last Modified: 2012-05-05
I would like to create a script that would run every Monday and check if today is first Monday of the month.  If it is, then continue with the execution. If it isn't then exit.  Any ideas?
0
Comment
Question by:Dmitriy
  • 2
3 Comments
 
LVL 14

Expert Comment

by:dfu23
ID: 11696615
well ... i'll assume you can schedul this with whatever ... like Window's Scheduler ...

set a scheduled task for a certain time to run on every Monday ...
the task would run the script which could handle checking if was the first Monday ...

i'm not extremely familiar with Perl but I think that you could then create a variable in the script with the current date ...
from that you could extract the current day and use that in a conditional

if (day <= 7)
  continue execution
else
  exit script
0
 

Accepted Solution

by:
permanentE earned 50 total points
ID: 11696883
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
if ($wday==1 && $mday <=7) {

    ....

}
0
 
LVL 14

Expert Comment

by:dfu23
ID: 11697547
man i wish i knew perl better :(
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

733 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