maybe I'm asking a VERY dumb question, but would anybody out there tell me, why this f****** script won't work if executed as a cronjob, but works fine if executed from a shell prompt?
The purpose of the script is self-explaining. It pings two remote vpn gateways and restarts ipsec, if one of the pings fails. Timestamps, errors and ipsec restart are logged.
set PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
is something that you would use in a csh script; not bash . In a bash script, that command sets the 1st positional parameter for the current shell execution environment to PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ; it does not change the value of the PATH environment variable for that script. Try changing it to: