- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Checking on cron
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
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
11-19-2004 01:45 AM
11-19-2004 01:45 AM
Meaning it is not running.
I need a process that checks to see if the cron process is not running and starts it.
Since I can not have a job running in cron to do that, how do I make a process run as a daemon.
I don't know how to start a job to run as a process.
Can you point me to how to do it?
Simple script could be some thing like this:
# test_cron.sh
while [ true ]
do
if [ `ps -ef|grep cron|wc -l` -lt 1 ];then "start cron";fi
sleep 10800 # 3 hrs
done
# end
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2004 01:50 AM
11-19-2004 01:50 AM
Re: Checking on cron
I would be more intersted in why cron is stopping. Have you checked /var/adm/syslog/syslog.log and /var/amd/cron/log to see if there's any indication of problems there? Have you applied the latest cron patches?
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2004 01:52 AM
11-19-2004 01:52 AM
Re: Checking on cron
Also look in /var/adm/cron/log, /var/adm/syslog/syslog.log, and /var/adm/messages for any error messages about cron.
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2004 01:54 AM
11-19-2004 01:54 AM
Re: Checking on cron
Something is happening to stop the daemon.
Maybe:
http://www1.itrc.hp.com/service/patch/patchDetail.do?BC=patch.breadcrumb.main|patch.breadcrumb.search|&patchid=PHCO_26562&context=hpux:800:11:11
Don't know why this one came up but its worthwhile to have in.
http://www1.itrc.hp.com/service/patch/patchDetail.do?BC=patch.breadcrumb.main|patch.breadcrumb.search|&patchid=PHCO_30598&context=hpux:800:11:11
If I got the OS wrong, next time post it so I can give you the righ patches.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2004 01:54 AM
11-19-2004 01:54 AM
Solution11.11 - PHCO_26562 http://www2.itrc.hp.com/service/patch/patchDetail.do?BC=patch.breadcrumb.main|patch.breadcrumb.pdb|patch.breadcrumb.search|&patchid=PHCO_26562&context=hpux:800:11:11
11.0 - PHCO_27141 http://www2.itrc.hp.com/service/patch/patchDetail.do?BC=patch.breadcrumb.main|patch.breadcrumb.pdb|patch.breadcrumb.search|&patchid=PHCO_27141&context=hpux:800:11:00
10.20- PHCO_27422 http://www2.itrc.hp.com/service/patch/patchDetail.do?BC=patch.breadcrumb.main|patch.breadcrumb.pdb|patch.breadcrumb.search|&patchid=PHCO_27422&context=hpux:800:10:20
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2004 02:00 AM
11-19-2004 02:00 AM
Re: Checking on cron
When I am working on some other scripts that I have to kill I might be killing the wrong PID. I have always traced it back to some thing I was doing when I found it was not running. It only happen once or twice a year. And since I have almost every thing automated I just thought I could check on cron too.
All my process are running through cron so I wanted to check on cron too.
Marty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2004 02:05 AM
11-19-2004 02:05 AM
Re: Checking on cron
I would look at your patch level before creating a work around for something that should work!
What is your O.S. Patch level:
check for patches at :
http://www5.itrc.hp.com/service/patch/search.do?BC=patch.breadcrumb.main|&pageContextName=hpux:::
for 11.11
http://www5.itrc.hp.com/service/patch/patchDetail.do?BC=patch.breadcrumb.main|patch.breadcrumb.search|&patchid=PHCO_26562&context=hpux:800:11:11
Regards,
Gideon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2004 02:14 AM
11-19-2004 02:14 AM
Re: Checking on cron
I agree, I will do the Patches. Maybe I am not doing it to myself.
The link you gave me is Europe. It will not let me connect saing that I am logged in.
Do you hav another Link in the US. or is this to PHCO_27141 that I can get to?
I have HP-UX 11.0.
Marty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2004 02:14 AM
11-19-2004 02:14 AM
Re: Checking on cron
Then maybe it's the way you're killing things - you're probably using "ps -ef |grep use_name" to identify the processes and end up picking up some stray processes along the way. Try this instead:
PROCESSES=`UNIX95= ps -U $USERNAME | grep -v PID |awk '{ print $1 }' | sort
-n`
for PROC in $PROCESSES
do
echo "\tKilling process $PROC"
kill $PROC
done
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2004 09:26 AM
11-19-2004 09:26 AM
Re: Checking on cron
PROCESSES=$(ps -ef|grep sh)
but you would then have a list containing unhashdaemon (big mistake), sshd (also a big mistake), and even ksh, csh, bash. What you need to do is to ask ps to search for you. ps can search by userID and also by exactmatch program name. ps -u some_user will give you all the processes for a single user, even if logged on multiple times. UNIX95 must be set to use the very useful option -C:
UNIX95= ps -f -C sh
And now you'll see ONLY sh processes.
As mentioned, cron never dies unless it was accidently killed and if so, you need to rehabilitate the killer...for it will kill again, perhaps randomly.
Bill Hassell, sysadmin