- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Cron Job Needed
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
03-06-2006 04:23 AM
03-06-2006 04:23 AM
Cron Job Needed
I have to make this cron job where if one of the proccess ( called PROV ) is less than 1 , then its probably down for maintanance and I need to send the page to team telling abt it.
Secondly, if the process is equal to 49, then i need to restart the application.
Thirdly , once I bounce the application( as in step 2) then it shud check whether the number of processes is equal to 49 and if not then notify the team.
I have the sample script in the attachment.
I need one single script to do all this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2006 04:55 AM
03-06-2006 04:55 AM
Re: Cron Job Needed
1) Use full paths for the script.
You need to make sure that any environment variables that are needed are added to the script. You need to make sure that you use full paths for all the commands in the script.
2) In crontab, you would add a line that would say:
30 12 * * 0 /mypath/myscript
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2006 06:01 AM
03-06-2006 06:01 AM
Re: Cron Job Needed
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2006 07:55 AM
03-06-2006 07:55 AM
Re: Cron Job Needed
no, I see two problems:
1) you need to recalculate $prov after the restart, otherwise it will still contain the value from the very beginning (most likely 49, if the script decided for a bounce)
2) if anyone has a "vi" to file with one of the "grep" target-words (like "vi PROVIDENCE"), you will misscalculate. Is there a way using an application tool to query the application "are you up and ok ?".
Hope this helps
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2006 04:19 AM
03-07-2006 04:19 AM
Re: Cron Job Needed
. /appl/s/test/cur/admin/tux/.profile
prov=`ps -ef|grep -v grep |grep PROV |grep sld|grep -v PROVUPD|grep -v PROVFTTP|wc -l`
if [ $prov -lt 1 ]
then
mailx -s "Prov is down so I am not retstarting it" vg@tt.com < /tmp/1.txt
exit
fi
if [ $prov -eq 27 -o $prov -gt 1 ]
then
/appl/tux/bin/tmshutdown -w 30 -s PROV 2>&1 > /tmp/provbounce.log
/appl/tux/bin/tmshutdown -w 30 -s PROVMGR 2>&1 >> /tmp/provbounce.log
/appl/tux/bin/tmboot -s PROVMGR 2>&1 >> /tmp/provbounce.log
/appl/tux/bin/tmboot -s PROV 2>&1 >> /tmp/provbounce.log
check_prov
fi
check_prov()
{
prov_new=`ps -ef|grep -v grep |grep PROV |grep sld|grep -v PROVUPD|grep -v PROVFTTP|wc -l`
if [ $prov_new -lt 27 -a $prov_new -gt 1 ]
then
mailx -s "Not all PROV processes started after bounce" vg@tt.com < /tmp/provbounce.log
fi
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2006 04:21 AM
03-07-2006 04:21 AM
Re: Cron Job Needed
check_prov: not found
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2006 05:51 AM
03-07-2006 05:51 AM
Re: Cron Job Needed
If you are going to use functions in a script, you have to define them before you call them. Move your function definition to the top of the script, and you should be ok.
Regards,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2006 06:02 AM
03-07-2006 06:02 AM