Your script will include the grep line which contains the pattern you are looking for.
Code:
ps -ef | grep server
jschiwal 2714 21717 0 00:44 pts/4 00:00:00 grep server
jschiwal 2786 2535 0 Mar14 ? 00:00:00 kwrapper4 ksmserver
...
You will have other false matches as well.
It would probably be better to check services using it's startup script with a "status" option. If this is a server you wrote yourself. A service usually creates a .pid file the contents of which is the PID of the process. A shell wrapper could echo $$ to a file, and you could use that files value.
You could also use `pidof' to return the pid of a named command.
Code:
jschiwal@qosmio:~> ps -p $(pidof caliber) >/dev/null 2>&1 && echo OK || echo FAILED
FAILED
jschiwal@qosmio:~> ps -p $(pidof calibre) >/dev/null 2>&1 && echo OK || echo FAILED
OK