0

I was trying to schedule this script onto the crontab but the script is not running as expected. I can execute the script manually and it runs as expected generating the list using the command list-users and emails the list but it does not execute when scheduled in the crontab.

echo "Starting script"
list-users primary_number organization.eq.1002 > /var/tmp/ListUserOutput.txt
mail -s 'List Users Org 1002' example@gmail.com < /var/tmp/ListUserOutput.txt
echo "Ending script"

This is how it is scheduled in the crontab:

0 9 * * * /var/tmp/Script.sh > /var/tmp/Script.log 2>&1

And this is the output of the Script.log

/bin/sh: /var/tmp/Script.sh: /bin/bash^M: bad interpreter: No such file or directory

Riley Spotton
  • 231
  • 1
  • 2
  • 8
  • Could you post the content of Script.sh? btw, you should use .bash instead of .sh – Gery Feb 24 '21 at 17:53
  • The `^M` means that your script has DOS/Windows style carriage return line endings. You should convert the script to Unix line endings. – that other guy Feb 24 '21 at 17:58

0 Answers0