I have the following script:
#!/bin/bash
echo "$(date +"%r")"
if [ "$FOLDER_ID" != "0" ]
then
node /sync.js -d $FOLDER_ID -l /Downloads
fi
I'm using docker container and I have passed the env variable FOLDER_ID when started the container. This variable supposed to be set when starting the docker container by passing it as ENV.
When I run this script, the node command runs as expected, but when the cron job runs the script, it prints the date at but doesn't execute the node command correctly (I think the issue is related to the $FOLDER_ID variable).
echo "$(date +"%r")"
is just a long way of sayingdate +%r
. Separately, I don't supposeFOLDER_ID
has any spaces or tabs in it? – Jeff Schaller Mar 09 '19 at 01:26FOLDER_ID
variable), you'll need to set them explicitly before using them in your script. – Haxiel Mar 09 '19 at 04:45$PATH
that does not contain the directory wherenode
is located. You can modifyPATH
in the script though. – Kusalananda Mar 09 '19 at 08:17