Solved

Checking if today is the first Monday of the month

Posted on 2004-08-02
3
342 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

776 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