mercredi 8 juillet 2020

How to remove this error while executing another shell script?

I am trying to create one script which check for running process and start if it is not running.

#!/bin/bash
if pgrep infiloop > /dev/null  then
  echo "Process is running."
else
  echo /u/gs/infiloop.sh
  echo "Process was not running."
fi

But i am getting below error:

./checkforRunningJob.sh: line 5: syntax error near unexpected token `else'
./checkforRunningJob.sh: line 5: `else'

Thanks for the help.

Aucun commentaire:

Enregistrer un commentaire