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