[X-Unix] kill and restart filemaker

David Ledger dledger at ivdcs.demon.co.uk
Wed May 31 10:03:33 PDT 2006


>From: Ferdinand Fuchs <indy27 at mac.com>
>hello,

>I try to make a script to kill filemaker (we use it with 
>webcompanion and webstar for a website) if it hangs but have already 
>problems at the beginning.
>
>first how do I determine if filemaker hangs - I thought about to 
>ping the port 5003, that uses filemaker, so the first line of my 
>script would be
>
>nmap -PE localhost | grep 5003 > /tmp/status.txt
>
>now I thought I could use "if then else" but I couldn't find a 
>syntax that would fit for
>
>if status.txt does contain the word 5003 then kill filemaker and 
>open specific filemaker-files afterwards else do nothing
>
>it would be cool if somebody could give me a clue to create such a 
>script - thanks!
>ferdinand

The command pipeline you have will return with status 0 if the grep 
succeeded, non-0 otherwise, so

if nmap -PE localhost | grep -q 5003; then
	...
fi

would do it. The '-q' (quiet) is instead of a '>/dev/null 2>&1'

David


-- 
David Ledger - Freelance Unix Sysadmin in the UK.
Chair of HPUX SysAdmin SIG of hpUG technical user group (www.hpug.org.uk)
david.ledger at ivdcs.co.uk
www.ivdcs.co.uk


More information about the X-Unix mailing list