Solved

Checking if today is the first Monday of the month

Posted on 2004-08-02
3
370 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Six Sigma Control Plans

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