Linux command does not run from crontab, but it runs fine from the Linux shell
-2
votes
1
answer
93
views
I set up the following cron job to check every minute if port 8088 is listening. If it isn't, the CLI should write the message
Thu Jul 3 12:50:09 UTC 2025 bad
to the log file
/tmp/crob_log
.
Here is the cron entry:
crontab -e
* * * * * root wget http://DB_SERVER_we:8088 ; [ $? -ne 0 ] && echo date
bad >> /tmp/crob_log
However, the cron job always logs the "bad" message, even though the exit status from wget http://DB_SERVER_we:8088
is 0.
When I run the same command manually on the Linux machine, it works fine (no "bad" message), which is the expected behavior.
But when it runs from cron, it always logs "bad".
So, what's wrong with the command line in the crontab?
Asked by yael
(13936 rep)
Jul 3, 2025, 12:57 PM
Last activity: Jul 3, 2025, 05:57 PM
Last activity: Jul 3, 2025, 05:57 PM