- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- cron question
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
тАО07-22-2010 12:24 PM
тАО07-22-2010 12:24 PM
IS there any way to setup a cron entry that runs every 15 minutes from 5am to 9pm. Don't think it is possible but thought I'd ask someone who is smarter than I.
Norm
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2010 12:59 PM
тАО07-22-2010 12:59 PM
Re: cron question
have cron run a script every 15 minutes, and
have that script look at the time to see if
it should do anything.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2010 01:16 PM
тАО07-22-2010 01:16 PM
Solution00,15,30,45 5-20 * * * /do/something
00 21 * * * /do/something
The first entry will run every 15 minutes from 5:00 AM to 8:45 PM. The 2nd entry will run at 9:00 PM.
If you were to specify the hours of the first entry as 5-21, then your script would run at 9:00 PM, 9:15 PM, 9:30 PM and 9:45 PM, which is not desirable, if I read your question correctly. Thus, the 2 step process.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2010 01:17 PM
тАО07-22-2010 01:17 PM
Re: cron question
Good idea, not sure how to do that in the script, here is the script:
ps -ef | grep -i "httpd.conf -k" | grep -v grep
if [ $? = 0 ];then
echo "Zend is running on ${HOST} OK at `date`" >> $HISTFILE
else
sleep 1
echo "Zend down on $HOST at `date`" > $MAILFILE1
cat $MAILFILE1 | mailx -s "Zend_Down on $HOST" root
cat $MAILFILE1 >> $HISTFILE
fi
Let me know if you have a idea of how to get this script to look at time and not run the if statement.
Thank you
Norm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2010 01:21 PM
тАО07-22-2010 01:21 PM
Re: cron question
Excellent!!!
Thank you
Norm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2010 01:31 PM
тАО07-22-2010 01:31 PM
Re: cron question
> time [...]
man date
x=$(date +%H)
echo $x
Test the hour in a preliminary "if"
statement.
> [...] Thus, the 2 step process.
You'd probably need to do that (and look at
the minutes, "%M") with this scheme, too.
Some clever string comparisons might be
easier than looking at the numbers as
numbers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2010 03:30 PM
тАО07-22-2010 03:30 PM
Re: cron question
# Cron run every 15 min from 5:00am to 9:45pm
00,15,30,45 5-21 * * * myscript
# Top of myscript
[ $(date +%H%M) -gt 2100 ] && exit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2010 03:47 PM
тАО07-22-2010 03:47 PM
Re: cron question
Patrick response did the trick, I need to only run the script until 9pm. Will try your add to the script.
Thank you
Norm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2010 03:56 PM
тАО07-22-2010 03:56 PM