I
I
ironheaddd2020-04-15 17:09:10
bash
ironheaddd, 2020-04-15 17:09:10

Why doesn't sh script run in crontab?

There is a script:

#!/bin/bash
CHECK='server-release is not running ... failed!'   #строка для проверки
STATUS=$(/home/user/server/server/build.sh status)    #запись статуса сервера в переменную
if [ "$CHECK" == "$STATUS" ] 
  then
  echo "server is stopped"
  rm -f /home/user/server/server/server.pid
  /home/user/server/server/build.sh startd
else
  echo "server is worked"
fi


If you just execute the /etc/starter.sh script, then everything works fine, the conditions are met, the build.sh script also runs. The crontab entry was made: sudo crontab -e, in the crontab itself I wrote:
crontab

* * * * * bash /bin/bash /etc/starter.sh > /tmp/starter.log 2>&1

in the logs /tmp/starter.log
/bin/bash: /bin/bash: unable to start binary file

How to properly make a crontab entry so that this script is executed every minute?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2020-04-15
@ironheaddd

And so?

* * * * * /bin/bash /etc/starter.sh > /tmp/starter.log 2>&1

And also the question is why are you checking the text and not the completion code?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question