3

Contents of script:

#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

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
0

1 Answer 1

2

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:

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

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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .