- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: why could not find 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
тАО07-19-2006 09:52 PM
тАО07-19-2006 09:52 PM
My platform is hp 11i.
I user timer.sh to start a program timer чГнrepeatly. the content of timer.sh is:
while(true)
do
if [ "`ps -ef|grep './timer '|grep -v grep`" = "" ]
then
./timer IBSS2 WSNADRR=//132.97.9.71:2888 >/dev/null 2>&1
sleep 32
else
sleep 32
fi
done
I start timer.sh in this way:
ksh
timer.sh &
exit
but when I use ps -fe|grep timer.sh ,
I find nothing ,I think the timer.sh should stay alive all the time. in fact the timer exec repeatly.
can anyone tell me why ?
thx a lot
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-19-2006 10:03 PM
тАО07-19-2006 10:03 PM
Re: why could not find process?
Also, whay all that grep? If you know process name (exact process name), then you can do as follows.
proc_pid=$(UNIX95= ps -C "timer" -o pid|grep -v 'PID)
kill -o ${proc_pid} || "start_your_program"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-20-2006 03:19 AM
тАО07-20-2006 03:19 AM
SolutionIf not, it will just execute the contents of the script and not show the script name in a process list. If you do a ps -fe | grep sleep I bet you'll see your sleep 32 processes there.
$cat timer.sh
while(true)
do
sleep 5
done
$./timer.sh &
[1] 13012
$ps -ef | grep timer
fifejj 13016 12414 0 11:23:59 pts/ta 0:00 grep timer
$ps -ef | grep 13012
fifejj 13012 12414 1 11:23:55 pts/ta 0:00 -ksh
fifejj 13018 13012 1 11:24:00 pts/ta 0:00 sleep 5
and now invoking a new shell:
$cat timer.sh
#!/bin/ksh
while(true)
do
sleep 5
done
$./timer.sh &
[1] 13028
$ps -ef | grep timer
fifejj 13032 12414 1 11:24:28 pts/ta 0:00 grep timer
fifejj 13028 12414 3 11:24:26 pts/ta 0:00 /bin/ksh ./timer.sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-20-2006 07:52 PM
тАО07-20-2006 07:52 PM
Re: why could not find process?
timer.sh
what is the diference betwen ksh and #!/bin/ksh?
if I use #!/bin/ksh , it seem that I can grep ./timer.sh ?
we have servral programs , all exex like
this :
ksh
program1 $
exit
ksh
program2 $
exit
I donot know why they exec like this.
can I exec them like this? :
#!/bin/ksh
program1 $
program2 $
exit
thanks a lot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-21-2006 12:02 AM
тАО07-21-2006 12:02 AM
Re: why could not find process?
It should be fine to run them in an executable script as
#!/bin/ksh
program1
program2
exit
Jon