Inside the shell script sing the full path to the Azure CLI & Node JS.
#!/bin/bash
/opt/nodejs/bin/node /opt/nodejs/bin/azure vm disk list > /tmp/tmpfile
/opt/nodejs/bin/node /opt/nodejs/bin/azure vm disk upload $SRCURL $DESURL <KEY>
When executed manually both the commands are getting executed successfully. But when executed using crontab vm disk list command is working but vm disk upload is not working.
Azure JS script requires another cli.js which is been referenced through relative path var AzureCli = require('../lib/cli'); and the cli.js script requires lots of other scripts which is been referenced through relative path.
Is there any way to provide the same environment profile as the user to cron hence it works or is there any best way to make this work without editing individual JS file and rename the relative path to absolute path?