Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.misc > #1167 > unrolled thread
| Started by | laredotornado <laredotornado@zipmail.com> |
|---|---|
| First post | 2011-05-19 06:47 -0700 |
| Last post | 2011-05-19 13:29 -0400 |
| Articles | 6 — 5 participants |
Back to article view | Back to comp.os.linux.misc
Getting the PID of a process ID laredotornado <laredotornado@zipmail.com> - 2011-05-19 06:47 -0700
Re: Getting the PID of a process ID gazelle@shell.xmission.com (Kenny McCormack) - 2011-05-19 16:53 +0000
Re: Getting the PID of a process ID "laredotornado@zipmail.com" <laredotornado@gmail.com> - 2011-05-19 10:10 -0700
Re: Getting the PID of a process ID Huibert Bol <huibert.bol@quicknet.nl> - 2011-05-19 19:41 +0200
Re: Getting the PID of a process ID laredotornado <laredotornado@zipmail.com> - 2011-05-19 11:11 -0700
Re: Getting the PID of a process ID Bill Marcum <bill@lat.localnet> - 2011-05-19 13:29 -0400
| From | laredotornado <laredotornado@zipmail.com> |
|---|---|
| Date | 2011-05-19 06:47 -0700 |
| Subject | Getting the PID of a process ID |
| Message-ID | <58a25ff3-28fa-4662-9455-5bbc2db02946@x1g2000yqb.googlegroups.com> |
Hi,
I'm using Ubuntu 11.04. How do I get the process ID of a process I
just kicked off in a script? I have
/usr/bin/Xvfb :15 -ac -screen 0 1024x768x16 &
XVFB_PID=$!
echo $XVFB_PID > /var/run/xvfb.pid
su selenium -c 'java -jar /opt/selenium/selenium-server-
standalone-2.0b3.jar -userExtensions /opt/selenium/user-extensions.js
> /var/log/se_rc_server.log 2>&1 &'
PID=$!
echo $PID > /var/run/selenium-server.pid
However both the XVFB_PID and PID are the same value, and neither is
the value of what was just kicked off. Appreciate pointers on how to
store the correct PID in the variables. Thanks, - Dave
[toc] | [next] | [standalone]
| From | gazelle@shell.xmission.com (Kenny McCormack) |
|---|---|
| Date | 2011-05-19 16:53 +0000 |
| Message-ID | <ir3hv2$e7c$1@news.xmission.com> |
| In reply to | #1167 |
In article <58a25ff3-28fa-4662-9455-5bbc2db02946@x1g2000yqb.googlegroups.com>, laredotornado <laredotornado@zipmail.com> wrote: >Hi, > >I'm using Ubuntu 11.04. How do I get the process ID of a process I >just kicked off in a script? I have > > /usr/bin/Xvfb :15 -ac -screen 0 1024x768x16 & > XVFB_PID=$! > echo $XVFB_PID > /var/run/xvfb.pid > su selenium -c 'java -jar /opt/selenium/selenium-server- >standalone-2.0b3.jar -userExtensions /opt/selenium/user-extensions.js >> /var/log/se_rc_server.log 2>&1 &' > PID=$! > echo $PID > /var/run/selenium-server.pid > >However both the XVFB_PID and PID are the same value, and neither is >the value of what was just kicked off. Appreciate pointers on how to >store the correct PID in the variables. Thanks, - Dave Try using the "pidof" command. -- "Remember when teachers, public employees, Planned Parenthood, NPR and PBS crashed the stock market, wiped out half of our 401Ks, took trillions in TARP money, spilled oil in the Gulf of Mexico, gave themselves billions in bonuses, and paid no taxes? Yeah, me neither."
[toc] | [prev] | [next] | [standalone]
| From | "laredotornado@zipmail.com" <laredotornado@gmail.com> |
|---|---|
| Date | 2011-05-19 10:10 -0700 |
| Message-ID | <38c2fa6b-b141-4cc4-9fcf-81501633ff95@d28g2000yqf.googlegroups.com> |
| In reply to | #1170 |
On May 19, 11:53 am, gaze...@shell.xmission.com (Kenny McCormack) wrote: > In article <58a25ff3-28fa-4662-9455-5bbc2db02...@x1g2000yqb.googlegroups.com>, > > > > laredotornado <laredotorn...@zipmail.com> wrote: > >Hi, > > >I'm using Ubuntu 11.04. How do I get the process ID of a process I > >just kicked off in a script? I have > > > /usr/bin/Xvfb :15 -ac -screen 0 1024x768x16 & > > XVFB_PID=$! > > echo $XVFB_PID > /var/run/xvfb.pid > > su selenium -c 'java -jar /opt/selenium/selenium-server- > >standalone-2.0b3.jar -userExtensions /opt/selenium/user-extensions.js > >> /var/log/se_rc_server.log 2>&1 &' > > PID=$! > > echo $PID > /var/run/selenium-server.pid > > >However both the XVFB_PID and PID are the same value, and neither is > >the value of what was just kicked off. Appreciate pointers on how to > >store the correct PID in the variables. Thanks, - Dave > > Try using the "pidof" command. > > -- > "Remember when teachers, public employees, Planned Parenthood, NPR and PBS > crashed the stock market, wiped out half of our 401Ks, took trillions in > TARP money, spilled oil in the Gulf of Mexico, gave themselves billions in > bonuses, and paid no taxes? Yeah, me neither." Thanks for this, but how do I narrow things down? If I do pidof java THat returns all running Java processes, and I only want to reference the Selenium process that I launch above. - Dave
[toc] | [prev] | [next] | [standalone]
| From | Huibert Bol <huibert.bol@quicknet.nl> |
|---|---|
| Date | 2011-05-19 19:41 +0200 |
| Message-ID | <ir3kng$nc4$1@dont-email.me> |
| In reply to | #1167 |
laredotornado <laredotornado@zipmail.com> wrote: > Hi, > > I'm using Ubuntu 11.04. How do I get the process ID of a process I > just kicked off in a script? I have > > /usr/bin/Xvfb :15 -ac -screen 0 1024x768x16 & > XVFB_PID=$! > echo $XVFB_PID > /var/run/xvfb.pid > su selenium -c 'java -jar /opt/selenium/selenium-server- > standalone-2.0b3.jar -userExtensions /opt/selenium/user-extensions.js >> /var/log/se_rc_server.log 2>&1 &' > PID=$! > echo $PID > /var/run/selenium-server.pid > > However both the XVFB_PID and PID are the same value, and neither is > the value of what was just kicked off. Appreciate pointers on how to > store the correct PID in the variables. Thanks, - Dave XVFB_PID should be correct; PID won't because 'su' isn't started as a background job. Try: PID=$(su selinium -c 'java -jar /o[...]er.log 2>&1 & echo $!') -- Huibert "Okay... really not something I needed to see." --Raven
[toc] | [prev] | [next] | [standalone]
| From | laredotornado <laredotornado@zipmail.com> |
|---|---|
| Date | 2011-05-19 11:11 -0700 |
| Message-ID | <2fa0e3fd-caf6-42dc-b329-a78e75480915@c41g2000yqm.googlegroups.com> |
| In reply to | #1172 |
On May 19, 12:41 pm, Huibert Bol <huibert....@quicknet.nl> wrote: > laredotornado <laredotorn...@zipmail.com> wrote: > > Hi, > > > I'm using Ubuntu 11.04. How do I get the process ID of a process I > > just kicked off in a script? I have > > > /usr/bin/Xvfb :15 -ac -screen 0 1024x768x16 & > > XVFB_PID=$! > > echo $XVFB_PID > /var/run/xvfb.pid > > su selenium -c 'java -jar /opt/selenium/selenium-server- > > standalone-2.0b3.jar -userExtensions /opt/selenium/user-extensions.js > >> /var/log/se_rc_server.log 2>&1 &' > > PID=$! > > echo $PID > /var/run/selenium-server.pid > > > However both the XVFB_PID and PID are the same value, and neither is > > the value of what was just kicked off. Appreciate pointers on how to > > store the correct PID in the variables. Thanks, - Dave > > XVFB_PID should be correct; PID won't because 'su' isn't started as a > background job. Try: > > PID=$(su selinium -c 'java -jar /o[...]er.log 2>&1 & echo $!') > > -- > Huibert > "Okay... really not something I needed to see." --Raven Hi Huibert, Thanks for the concise solution. Worked like a dream, - Dave
[toc] | [prev] | [next] | [standalone]
| From | Bill Marcum <bill@lat.localnet> |
|---|---|
| Date | 2011-05-19 13:29 -0400 |
| Message-ID | <slrnitaks3.5u2.bill@lat.localnet> |
| In reply to | #1167 |
On 2011-05-19, laredotornado <laredotornado@zipmail.com> wrote: > Hi, > > I'm using Ubuntu 11.04. How do I get the process ID of a process I > just kicked off in a script? I have > > /usr/bin/Xvfb :15 -ac -screen 0 1024x768x16 & > XVFB_PID=$! > echo $XVFB_PID > /var/run/xvfb.pid > su selenium -c 'java -jar /opt/selenium/selenium-server- > standalone-2.0b3.jar -userExtensions /opt/selenium/user-extensions.js >> /var/log/se_rc_server.log 2>&1 &' > PID=$! > echo $PID > /var/run/selenium-server.pid > > However both the XVFB_PID and PID are the same value, and neither is > the value of what was just kicked off. Appreciate pointers on how to > store the correct PID in the variables. Thanks, - Dave $! is the PID of the last process launched with "&" by the current shell. If the shell launches a process that forks another process, you might need some other means to find the PID. pidof and pgrep are useful but I don't know if they are standard. -- Linux and Windows both win. Best Documentary Feature: March of the Penguins Best Picture: Crash
[toc] | [prev] | [standalone]
Back to top | Article view | comp.os.linux.misc
csiph-web