- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Easter Date?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2006 07:44 AM
тАО02-24-2006 07:44 AM
We always schedule maintenance over the Easter Sunday weekend. Is there a method to automatically calculate this date? I just can't seem to find any relationship between the date from year to year.
TIA,
Ryan
Solved! Go to Solution.
- Tags:
- date arithmetic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2006 07:47 AM
тАО02-24-2006 07:47 AM
Re: Easter Date?
magnetic field strength unit is named) devised an algoritm. I wrote a shell script based on his algorithm many years ago. I may be able to find it but I know there are Perl modules for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2006 07:49 AM
тАО02-24-2006 07:49 AM
Re: Easter Date?
http://search.cpan.org/search?query=Easter&mode=all
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2006 07:58 AM
тАО02-24-2006 07:58 AM
SolutionThis will compute the date for you:
# cat ./easter
#!/usr/bin/perl
use strict;
use Date::Calc qw(Easter_Sunday);
my ($year,$month,$day) = Easter_Sunday($ARGV[0]);
print "Easter is $month/$day/$year\n";
Run as:
# ./easter 2006
Easter is 4/16/2006
...or pass any year to it.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2006 08:03 AM
тАО02-24-2006 08:03 AM
Re: Easter Date?
By the way, the computation of Easter's date can be done according to the algorithm presented here, if you really want to do so:
http://aa.usno.navy.mil/faq/docs/easter.html
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2006 08:16 AM
тАО02-24-2006 08:16 AM
Re: Easter Date?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2006 08:23 AM
тАО02-24-2006 08:23 AM
Re: Easter Date?
Thanks very much for the quick answers. I will probably use A. Clay's script only because my Perl skills are so limited.
Thanks,
Ryan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2006 08:39 PM
тАО02-24-2006 08:39 PM
Re: Easter Date?
Then you would just check the year against the end of the table, giving an error when it needs to be updated, or giving the date when it is there.
It would be as much code, much less error prone and readily tweakable for future special cases
Just a thought...
Hein.
http://aa.usno.navy.mil/faq/docs/easter.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2006 07:14 AM
тАО03-02-2006 07:14 AM
Re: Easter Date?
As a follow up to this question, I would like to send out a notification on the two Mondays before the Easter weekend. How could I make a cron entry which would do this?
TIA,
Ryan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2006 07:25 AM
тАО03-02-2006 07:25 AM
Re: Easter Date?
You could cron something like this:
0 8 3,10 4 1 mailx -s "Easter is April 16" root < /dev/null
Look at the manpages for 'crontab(1)'. The line above generates a mail to "root" with the message "Easter is April 16" on April 3 and April 10 (Mondays) at 0800.
Add that line to your root crontab or create a root crontab with 'vi'.
I like to do:
# crontab -l > /tmp/mycrontab
[ edit ]
# crontab /tmp/mycrontab
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2006 07:31 AM
тАО03-02-2006 07:31 AM
Re: Easter Date?
Your cron script should look something like this:
#!/usr/bin/sh
PATH=${PATH}:/usr/local/bin
export PATH
typeset -i STAT=0
typeset -i EDAYS=$(( $(caljd.sh $(easter.sh)) - $(caljd.sh) ))
if [[ ${EDAYS} <= 14 && ${EDAYS} -ge 0 ]]
then
echo "Do your thing"
# set STAT to a valid value for return
fi
exit ${STAT}
Here is the revised easter.sh that also outputs the year expected by caljd.sh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2006 07:32 AM
тАО03-02-2006 07:32 AM
Re: Easter Date?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2006 07:35 AM
тАО03-02-2006 07:35 AM
Re: Easter Date?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2006 07:38 AM
тАО03-02-2006 07:38 AM
Re: Easter Date?
if [[ ${EDAYS} <= 14 && ${EDAYS} -ge 0 ]]
SHOULD BE:
if [[ ${EDAYS} -le 14 && ${EDAYS} -ge 0 ]]
No points for this stupidity please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2006 07:39 AM
тАО03-02-2006 07:39 AM
Re: Easter Date?
Actually, so you don't get every Monday, unconditionally, change my crontab line to be:
0 8 3,10 4 * mailx -s "Easter is April 16" root < /dev/null
Now you will get a mail on April 3 and April 10 announcing the pending Easter.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2006 08:05 AM
тАО03-02-2006 08:05 AM
Re: Easter Date?
Thanks for the very quick answers. I'll study these and decide which one to use.
Thanks,
Ryan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2006 11:00 AM
тАО03-02-2006 11:00 AM
Re: Easter Date?
The original Perl script I offered can be embellished slightly. Then, add a small shell wrapper to define the number of days before Easter that you want to generate a mail event.
Cron the shell wrapper to run whenever you want it to run. This could be every day of every year if you choose. The shell wrapper is silent unless Easter is 14-days or less away. As a cron'ed script, un-redirected output is mailed to the initiating user, so you don't have to do anything more than run it.
The Perl script is attached and is called '.easter.pl'. If you run it without an argument the current year is assumed. It's output looks like this:
# ./easter.pl
45 days from now is Easter on 04/16/2006
# ./easter.pl 2007
402 days from now is Easter on 04/08/2007
The shell wrapper to cron looks like this:
#!/usr/bin/sh
RSLT=`/usr/local/bin/easter.pl`
LEFT=`echo ${RSLT} | cut -f1 -d " "`
if [ "${LEFT}" -le 14 ]; then
echo ${RSLT}
fi
exit 0
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2006 12:20 PM
тАО03-02-2006 12:20 PM
Re: Easter Date?
Ooops. Since I'm sure you don't want a notice announcing that Easter has passed; as for instance, on April 17 that Easter was -1 days ago for 2006.
Therefore, cron this shell wrapper:
#!/usr/bin/sh
RSLT=`/usr/local/bin/easter.pl $1`
LEFT=`echo ${RSLT} | cut -f1 -d " "`
if [ "${LEFT}" -ge 0 -a "${LEFT}" -le 14 ]; then
echo ${RSLT}
fi
exit 0
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2006 01:39 PM
тАО03-02-2006 01:39 PM