How do i make the script auto-restart i think there is some issue in the last line .
#!/bin/bash
# a shell script that keeps looping until an exit code is given
php_command="php -q -f $1.php "
shift
nice $php_command $@
ERR=$?
..............
..............
exec $0 $@
I get the follwoing error exec: 36: ss.sh: not found
You can use
set -eand a simplewhileloop in bash:Once the PHP script returns an exit code of non-zero the bash script will stop. If you need to run any code after the loop is done, you can do this instead: