- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- again my script!
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-15-2003 09:01 PM
09-15-2003 09:01 PM
(os hpux 10.10)
i write a script ,if it doesn't exist in my system ,start the rpcd daemon!
my script:
#!/usr/bin/sh
RPCD=$(ps -ef|grep -v grep|grep -c rpcd)
if [ $RPCD -eq 0 ]
then
/opt/dce/sbin/rpcd >>/script/rpcd/error.log2>&1
date >>/script/rpcd/date
fi
my cron is set (ervery five minute to check):
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /script/rpcd/shell >>/script/rpcd/error.log 2>&1
i can execute the script manually,but cron can't
why?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2003 09:04 PM
09-15-2003 09:04 PM
Re: again my script!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2003 09:16 PM
09-15-2003 09:16 PM
Re: again my script!
Firstly, you have two processes writing to the same file. This won't stop it working but looks a bit odd. Either re-direct the output to error.log in the script or in the crontab file but it probably isn't wise to do it in both.
Secondly, ensure there is a space before the 2>&1 within the script. There might actually be one already but it doesn't look like it in a web browser.
It's not the normal way to start rpcd but it is perfectly valid so I wouldn't worry too much about that.
Does your error.log provide any clue as to why cron is failing. It looks OK from here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2003 09:16 PM
09-15-2003 09:16 PM
Re: again my script!
Yes, you are starting rpcd correctly.
There should be a script called /sbin/init.d/Rpcd that starts it at boot time which you could use.
I'd guess your cron problem might be that it doesn't know the path to grep. If grep doesn't reside in /usr/bin, then you need the full path name.
Cheers
Con
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2003 10:07 PM
09-15-2003 10:07 PM
Re: again my script!
i change the "opt/dce/sbin/rpcd >>/script/rpcd/error.log2>&1 "
to
"opt/dce/sbin/rpcd >>/script/rpcd/error.log 2>&1 "
but the problem still exist!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2003 10:18 PM
09-15-2003 10:18 PM
Re: again my script!
In cases like this, simplify!
try the following
ps -ef | grep -v grep | grep rpcd > /dev/null || {
/opt/dce/sbin/rpcd
}
See if it works
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2003 10:43 PM
09-15-2003 10:43 PM
Re: again my script!
the following is an entry :
CMD: /script/rpcd/shell >>/script/rpcd/error.log 2>&1
> root 8847 c Tue Sep 16 14:25:00 EAT 2003
< root 8847 c Tue Sep 16 14:25:00 EAT 2003
i prove that the cron well!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2003 10:43 PM
09-15-2003 10:43 PM
Re: again my script!
the following is an entry :
CMD: /script/rpcd/shell >>/script/rpcd/error.log 2>&1
> root 8847 c Tue Sep 16 14:25:00 EAT 2003
< root 8847 c Tue Sep 16 14:25:00 EAT 2003
it prove that the cron well!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2003 10:44 PM
09-15-2003 10:44 PM
Re: again my script!
there should be an error message in
/script/rpcd/error.log
saying what's wrong. Is that file empty?
Is the crontab for the same user as the command line user?
Check also /var/adm/cron/log for error messages.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2003 10:53 PM
09-15-2003 10:53 PM
Re: again my script!
Please let us know the contents of /script/rpcd/error.log it will show any errors that cron is giving.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2003 11:42 PM
09-15-2003 11:42 PM
Re: again my script!
but the file is empty!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2003 11:52 PM
09-15-2003 11:52 PM
Re: again my script!
#!/usr/bin/sh
ps -ef | grep -v grep | grep rpcd > /dev/null || {
/opt/dce/sbin/rpcd
}
With a cron entry of 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /script/rpcd/shell >> /script/rpcd/error.log 2>&1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 12:13 AM
09-16-2003 12:13 AM
Re: again my script!
when you run the script manually, what happens?
Do you get any kind of messages?
The reason I ask is because that I think rpcd checks if it is already running, and if that is the case it will not start up another process. That could explain why apparently nothing happens in cron.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 12:35 AM
09-16-2003 12:35 AM
Re: again my script!
i ever killed rpcd daemon manually!
but the script didn't start the rpcd!
i have test the
if [ $RPCD -eq 0 ]
was executed!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 12:44 AM
09-16-2003 12:44 AM
Re: again my script!
could you try to modify your script to this:
#!/usr/bin/sh
echo before first command
RPCD=$(ps -ef|grep -v grep|grep -c rpcd)
echo $?
echo after first command
if [ $RPCD -eq 0 ]
then
echo true
/opt/dce/sbin/rpcd >>/script/rpcd/error.log2>&1
echo $?
date >>/script/rpcd/date
fi
echo ended
and then run it on the command line and from cron? Please post the output from both.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 12:47 AM
09-16-2003 12:47 AM
Re: again my script!
Running out of ideas here but try running your script from cron but reading the users .profile as in
su - user -c "/script/rpcd/shell"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 01:37 AM
09-16-2003 01:37 AM
Re: again my script!
Try to create other script that calls to "shell" script, and put it on cron.
What happens?
Kind regards,
Zigor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 11:25 PM
09-16-2003 11:25 PM
Re: again my script!
my cron is set (ervery five minute to check):
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /script/rpcd/shell >>/script/rpcd/error.log 2>&1
/var/adm/cron/log:
> CMD: /script/rpcd/shell >>/script/rpcd/error.log 2>&1
> root 15098 c Wed Sep 17 12:35:00 EAT 2003
< root 15098 c Wed Sep 17 12:35:00 EAT 2003
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 11:33 PM
09-16-2003 11:33 PM
SolutionCron is actually starting the job but the job it is running.
That's why I want you to try doing the "su user - c" thing I mention in my last post.
It will have the same environment as when you run your script from the command line.
Also, check roots mail for output from cron.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2003 12:59 AM
09-17-2003 12:59 AM
Re: again my script!
thanks to you and all other !
but i run it when i am root !
i set up the cron as root too !
as you said
should i change the root's .profile file
and add an entry
su - root -c "/script/rpcd/shell" ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2003 01:21 AM
09-17-2003 01:21 AM
Re: again my script!
Before trying to use "su -" (which might be overkill) try running the script with "sh -x /script/rpcd/shell" in cron. That should show where it fails.
Regards,
Tom Geudens
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2003 01:54 AM
09-17-2003 01:54 AM
Re: again my script!
No, I am suggesting you do the su -root -c in your cron file. You say it works when you start it from the command line and I am trying to just make sure that it is not a problem with roots environment.
Let us know how it goes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2003 04:28 AM
09-17-2003 04:28 AM
Re: again my script!
and i killed the rpcd daemon manually
but when time comes
the rpcd daemon didn't start !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2003 04:30 AM
09-17-2003 04:30 AM
Re: again my script!
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2003 07:37 AM
09-17-2003 07:37 AM
Re: again my script!
no mail for root in fact!