You should take a live look at the processes using (h)top.
...
Code:
ps aux|grep "something"
will often discover the grep process itself, depending on the timing.
If you are looking for a list of only the matching processes, then traditionally you use
Code:
ps aux|grep "[s]omething"
since the regex doesn't match itself.
But I'd just check the return code of
Code:
pgrep -f calibre > /dev/null
rather than testing the integer value of three different commands in a pipe, ending with "wc".
Yes, the "if" builtin doesn't perform comparisons, it checks the return value of the "[" binary (alias for "test"). Make use of that fact to cut down on the rube goldberg code.
...
And as chaley said, you really should stick with software which is actually designed to restart unexpectedly-killed daemons. Monit is a great choice for that, but any decent init system should be able to handle that to some degree.