Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Checking if today is the first Monday of the month

Posted on 2004-08-02
3
Medium Priority
?
391 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 200 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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…
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

879 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