I am on ec2 instance ubuntu server and playing around with bash scripting. I have a very simple script which runs when the server reboots.
cd /home/ubuntu/d/web
echo "Start Phoenix server"** > server.log
whoami > server.log
date >> server.log
pwd >> server.log
source .env
mix phx.server >> server.log 2>&1
I got this error after the server reboots.
/home/ubuntu/startPhoenix.sh: 7: mix: not found
It works fine until the mix phx.server line.
I have this line in crontab -e file
@reboot /home/ubuntu/startPhoenix.sh
If I run the script like this, it works fine.
./startPhoenix.sh
What I don’t understand is why I am getting mix not found error.
I am using asdf for version control.
Any hint will be much appreciated.
Thanks.