- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to calculate in a script to not page/email me ...
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
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
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
09-06-2005 07:59 AM
09-06-2005 07:59 AM
if [ $HOUR > "$10PM" ] or [$HOUR < "$6AM" ];then
echo "DONT PAGE OR EMAIL " >> $LOG
exit 123
else
echo "Problem Daytime" |mailx -s "First, Lastname" pager@xyz.com
fi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 08:14 AM
09-06-2005 08:14 AM
SolutionHOUR=$(date +%H) # Get Hour in 24 hour time
if (( ${HOUR} < 6 || ${HOUR} >= 22 )) ; then
echo "DON'T PAGE OR EMAIL " >> $LOG
else
echo "Problem Daytime"|mailx -s "First, Lastname" pager@xyz.com
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 08:15 AM
09-06-2005 08:15 AM
Re: How to calculate in a script to not page/email me between certain hours ?
Do something like this:
...
mytime=`date '+%H%M'`
if [ "$mytime" -eq 0600 -o "$mytime" -eq 2200 ]; then
...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 08:19 AM
09-06-2005 08:19 AM
Re: How to calculate in a script to not page/email me between certain hours ?
integer myhour
myhour=`/usr/bin/date +%H`
if [ $myhour -lt 6 or $myhour -gt 22 ]
then
echo "DONT PAGE OR EMAIL " >> $LOG
exit 123
else
echo "Problem Daytime" |mailx -s "First, Lastname" pager@xyz.com
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 08:20 AM
09-06-2005 08:20 AM
Re: How to calculate in a script to not page/email me between certain hours ?
I will put it in and see if all looks good.
##DATE=`date`
##HOUR=`echo $DATE|awk '{print $4}'|cut -d: -f1`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 08:21 AM
09-06-2005 08:21 AM
Re: How to calculate in a script to not page/email me between certain hours ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 08:21 AM
09-06-2005 08:21 AM
Re: How to calculate in a script to not page/email me between certain hours ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 08:24 AM
09-06-2005 08:24 AM
Re: How to calculate in a script to not page/email me between certain hours ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 08:35 AM
09-06-2005 08:35 AM
Re: How to calculate in a script to not page/email me between certain hours ?
You can do like this :
HOUR=`date +%H`
if [ $HOUR -le 6 ] || [ $HOUR -ge 22 ]
then
echo "DONT PAGE OR EMAIL " >> $LOG
else
echo "Problem Daytime" |mailx -s "First, Lastname" pager@xyz.com
fi
######################################
Cheers ,
Raj.