Step by step ...
a) backticks are discouraged. Use better readable and nestable $( ) syntax instead:
b) As Andrew mentioned, getting the grep-command-PID is a pitfall. Gnu-ps allows to search immeadeately for a command:
c) Well - maybe there are just more options to ps? I.E. just return the PID?
(-Output: PID, = headline (empty))
d) How should you remember that funky syntax? -opid= -C ? Okay. Just use pidof:
e) we're getting close. An alternative is pgrep
f) You could call the PID together with the kill like this:
g) ... but still someone has foreseen that, and so let's introduce pkill:
is the solution.
Restarting has to go in a separate step, afaik.
Reading the man-page of pkill, pgrep etc. migth be a good inspiration for later.