HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: script linux
Operating System - Linux
1830233
Members
1858
Online
109999
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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-10-2005 09:07 PM
11-10-2005 09:07 PM
script linux
How i check if my process is running with a script?
ps -ef|grep pippo
how i check if pippo is running and then if not running start them??
ps -ef|grep pippo
how i check if pippo is running and then if not running start them??
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2005 09:44 AM
11-11-2005 09:44 AM
Re: script linux
while [ $?!=0 ]
do
ps -ef | grep bash
if [ $? -eq 0 ]
then
echo "Process Running"
else
echo "Run Your Process Here"
fi
sleep 5
done
do
ps -ef | grep bash
if [ $? -eq 0 ]
then
echo "Process Running"
else
echo "Run Your Process Here"
fi
sleep 5
done
Divide and Conquer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2005 12:16 PM
11-11-2005 12:16 PM
Re: script linux
Just a wierd skeleton for a poor man's "monitor" of a daemon.
e.g. see if sshd is running
# while $(pkill -0 -P 1 -x sshd); do echo sshd running;sleep 5;done;echo sshd died
sshd running
sshd running
sshd running
sshd running
sshd died
When from another terminal I sut down the sshd
# service sshd stop
Stopping sshd: [ OK ]
e.g. see if sshd is running
# while $(pkill -0 -P 1 -x sshd); do echo sshd running;sleep 5;done;echo sshd died
sshd running
sshd running
sshd running
sshd running
sshd died
When from another terminal I sut down the sshd
# service sshd stop
Stopping sshd: [ OK ]
Madness, thy name is system administration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2005 04:50 PM
11-13-2005 04:50 PM
Re: script linux
Just like as,
#!/bin/bash
ps -ef | grep -q 'pippo'
if [[ ${?} -eq 0 ]]
then
echo "Process pippo is running!"
ps -ef | grep pippo
else
# Process Startup
/pippo &
fi
# END
exit 0
########################
hth.
#!/bin/bash
ps -ef | grep -q 'pippo'
if [[ ${?} -eq 0 ]]
then
echo "Process pippo is running!"
ps -ef | grep pippo
else
# Process Startup
fi
# END
exit 0
########################
hth.
Easy to suggest when don't know about the problem!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP