- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Setting up cron job?
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-23-2006 08:43 PM
тАО07-23-2006 08:43 PM
I need to set up a cron job, I need only three days output would be required of the data, between 00:00 and 02:00 each day.
"Suspect an overflow is occurring. I need to see the output from the below command, which should run 15 minutes apart. The problem would be it might not occur for any given 15 minutes, I really need it every 15 minutes between midnight and 2 am., so I would need to set up a script to run from cron, to run the command below and sleep for 15 minutes etc.
date +"%T"; ps -eo "%x %C %t %g %u %P %p %n %z %c" | grep ldapdb2
Would you please advise how to create a small script. Please let me know and also how to put an entry in crontab for every 15 minutes starting from midnight until 2am everyday
Thanks for your help
Raf
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2006 09:01 PM
тАО07-23-2006 09:01 PM
Re: Setting up cron job?
the quickest way via cron would be to have a job start at minutes 00,15,30,45 and then check within the script whether the hour is between 00 and 02.
If you specify the hours as 00,01,02 the job would be submitted from 00:00 to 02:45.
On how to set up your cron job, please see:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1037403
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2006 09:10 PM
тАО07-23-2006 09:10 PM
Re: Setting up cron job?
Thanks Peter, I have worked it out on how to set up a cron job between 00 to 2am it should be like this,
0,15,30,45 00-2 * * * /scriptname > ouput
But I still need to know how to put the command below in a script,
"Suspect an overflow is occurring. I need to see the output from the below command, which should run 15 minutes apart. The problem would be it might not occur for any given 15 minutes, I really need it every 15 minutes between midnight and 2 am., so I would need to set up a script to run from cron, to run the command below and sleep for 15 minutes etc.
date +"%T"; ps -eo "%x %C %t %g %u %P %p %n %z %c" | grep ldapdb2,
Please advise
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2006 09:25 PM
тАО07-23-2006 09:25 PM
SolutionHave you tried editing your script and adding the lines
date +"%T"
ps -eo "%x %C %t %g %u %P %p %n %z %c" | grep ldapdb2
Any errors ?
Also your cron setup currently, means it runs 00:00 to 02:45 and will overwrite the outputfile everytime.
Replace > with >> before the outputfile to append.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2006 09:41 PM
тАО07-23-2006 09:41 PM
Re: Setting up cron job?
Hi Peter,
My script looks like this,
#!/usr/bin/ksh
date +"%T" >>/tmp/report
ps -eo "%x %C %t %g %u %P %p %n %z %c"|grep ldapdb2 >> /tmp/report
The above command runs successfully with no errors, however it just runs once as I need it to run every 15 minutes would it be okay to set a cron to run for every 15 minutes and that's that????
The problem would be it might not occur for any given 15 minutes, I really need it every 15 minutes between midnight and 2 am., so I would need to set up a script to run from cron, to run the command below and sleep for 15 minutes etc.
the cron entry should be below
0,15,30,45 0-2 * * * /tmp/cron.out 2>&1
if all the above is correct than I just need to configure a cron jon and that it? please advise
Thanks for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2006 10:38 PM
тАО07-23-2006 10:38 PM
Re: Setting up cron job?
As you said just enter, in case your script full path is /mydirectory/myscript in crontab
0,15,30,45 0,2 0 0 0 /mydirectory/myscript
and you will have it execution every 15 minutes from 2:00 till 2:45
Regards,
Borislav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2006 10:41 PM
тАО07-23-2006 10:41 PM
Re: Setting up cron job?
0,15,30,45 0,2 * * * /mydirectory/myscript
Sorry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2006 10:55 PM
тАО07-23-2006 10:55 PM
Re: Setting up cron job?
Thanks mate,
you say ops
0,15,30,45 0,2 * * * /mydirectory/myscript
Sorry
I need to run between 12pm and 2am and also don't specify - hyphen? or would it be ,
0,15,30,45 0-2 * * * /mydirectory/myscript
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2006 10:59 PM
тАО07-23-2006 10:59 PM
Re: Setting up cron job?
sorry to 12 midnight to 2am not 12pm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-24-2006 02:05 AM
тАО07-24-2006 02:05 AM