I have written a shell script for my Raspberry Pi to start a Node app that connects to the Losant MQTT broker. I added it to the crontab with a minute sleep prior to ensure the wifi was already connected. However, I don't think that the connection is happening, or if it is may be closing immediately. I checked the logs and it seems to make a connection and immediately close.
When I check the device connection log on the dashboard, there was never a connection made. Has anyone else experienced this or know how I might continue troubleshooting? Thank you!
Edit: Here's the crontab
@reboot sleep 60 && sh/home/pi/Desktop/losant/launcher.sh >/home/pi/logs/cronlog 2>&1
and my launcher script:
sudo node index.js
The script runs node and connects the pi to Losant normally if called manually from the command line.