Re: do shell script "ps -auxwww | grep rsync | grep -v grep"
Re: do shell script "ps -auxwww | grep rsync | grep -v grep"
- Subject: Re: do shell script "ps -auxwww | grep rsync | grep -v grep"
- From: Simon Forster <email@hidden>
- Date: Sat, 8 Oct 2005 19:14:32 +0100
On 7 Oct 2005, at 12:51, Mark J. Reed wrote:
You could wrap
it in a try/on error block, but it's probably better to just arrange
it such that the shell command line always exits with 0 and lets its
output convey the truth or falseness of the condition to AppleScript.
If the command is already something whose output will do that, then
you can just add an "; exit 0" at the end to make sure the shell exits
with code 0. If you need to know the exit status but don't want an
error to be thrown when it's not zero, put a ";echo $?" at the end,
which will cause the output of "do shell script" to be the exit status
itself.
...
-- find out if it's running; don't care what the pid is
set rsyncRunning to (do shell script "ps auxww | grep rsync | grep -v
grep >/dev/null; echo $?")
if rsyncRunning is "0" then
-- it's running
else
-- it's not running
end if
Perfect. Thank you. I had wrapped the "do shell scipt" in a try block
but I prefer not to rely on this as a conditional check. Knew that
there had to be a proper way of working round this - but flicking
through the man pages I couldn't find it.
All the best
Simon Forster
_____________________________________________________
LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK
Tel: +44 (0)70 9230 5244 Fax: +44 (0)70 9230 5247
_____________________________________________________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden