- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: 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
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
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
тАО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
Re: Easter Date?
- « Previous
-
- 1
- 2
- Next »