0

I m currently doing my project in Pfsense 2.4.4, to execute CURL into crontab */1 * * * * (every 1 minute) using bash script (script.sh). When i run the script using CLI it work perfectly, but when i put the script.sh into the crontab, it not work and CURL code line not respond any result.Kindly advise. Pfsense using FreeBSD operating system.

I already test the script.sh using commandline and it work perfectly, but not in crontab. After doing some investigation, the CURL code is avoided when execute the script using crontab. The script was execution in crontab, but it avoid the CURL code line inside the script itself.

script.sh

#!/bin/sh
status_code=$(curl --write-out %{http_code} --silent --output /dev/null https://google.com)
echo $status_code >> /home/log
echo $status_code

crontab

*/1     *       *       *       *       root    /home/script.sh

As a result, after the script execute, it will write the http-response code into /home/log file either 200 or 404 or etc.

Zubir
  • 89
  • 1
  • 10

0 Answers0