Contents of script:


rm list0.txt list1.txt list2.txt list3.txt print0.txt print1.txt print2.txt print3.txt

sleep 5

./checkip-1.sh </dev/null &>/dev/null &
sleep 5

./checkip-2.sh </dev/null &>/dev/null &
sleep 5

./checkip-3.sh </dev/null &>/dev/null &
sleep 5

./checkip-4.sh </dev/null &>/dev/null &
sleep 5

The scripts within the main scripts are working fine when I run them individually but not when I am calling them from the main script. I trying to run this using this crontab entry

cd /var/www/html/dashboard/scan/ && autoscan.sh

The script resides in /var/www/html/dashboard/scan/ and the directory is not in your PATH, so you can't execute the script by simply doing autoscan.sh, which is searching your PATH for autoscan.sh.

You need to mention that the script is in the current directory:

cd /var/www/html/dashboard/scan/ && ./autoscan.sh

Or simply:


Both assumes the script is executable by the user running it.

Unless you modify the autoscan.sh script, the last one won't work for you as you are running other scripts ./checkip-{1..4}.sh using relative paths from autoscan.sh, so a cd into /var/www/html/dashboard/scan/ is needed.

  • Thanks. The first option worked. I tried the second option it didn't work for some reason.
    – bran
    Aug 14 '16 at 15:08
  • 1
    @bran Check my edits..explained why the last one didn't work..
    – heemayl
    Aug 14 '16 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.