- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script to check/start process
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
тАО09-16-2009 10:50 PM
тАО09-16-2009 10:50 PM
I need a script to:
1. check a process "ps -ef | grep ecoc"
2. if display "/opt/vantage/bin/ecocComputer-p 1 -t 0"
3. OK, then exit.
4. else start/execute "/opt/vantage/bin/restart_ecoagt
thanks,
Ahmed
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2009 11:01 PM
тАО09-16-2009 11:01 PM
Re: script to check/start process
quick & dirty and not tested but should give you an idea
#!/usr/bin/sh
ps -ef | grep eoc
If [ $? = 0 ]; then
exit 0
else
/opt/vantage/bin/restart_ecoagt
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2009 11:14 PM
тАО09-16-2009 11:14 PM
Re: script to check/start process
instead of ps -ef | grep eoc use:
ps -ef | grep -w eoc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2009 11:15 PM
тАО09-16-2009 11:15 PM
Re: script to check/start process
It should like this
#!/usr/bin/sh
ps -ef | grep eoc
If [ $? = 0 ];
then
/opt/vantage/bin/ecocComputer-p 1 -t 0
else
/opt/vantage/bin/restart_ecoagt
fi
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2009 11:16 PM
тАО09-16-2009 11:16 PM
Re: script to check/start process
ps -ef | grep -w ecoc | grep -v grep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2009 11:58 PM
тАО09-16-2009 11:58 PM
Re: script to check/start process
it looks the RC is always "0" as it is not excuting the else command to restart the process!
ps -ef | grep ecoc
#ps -ef | grep -w ecocComputer
if [ $? = 0 ]; then
echo ServerVantage is OK running with ecocComputer process...
else
/opt/vantage/bin/restart_ecoagt
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2009 12:12 AM
тАО09-17-2009 12:12 AM
Solutionps -ef | grep whatever
will in most cases return at least the process line for the grep command, and therefore you get "0".
Instead of
ps -ef | grep ecoc
try this line:
$(UNIX95= ps -C ecoc > /dev/null)
the space after the equal sign is important!
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2009 01:54 AM
тАО09-17-2009 01:54 AM
Re: script to check/start process
script now working.
points also given.