Reputation: 11
I have a script of the following format:
#!/bin/bash
cd /abc/def/user1/test
export NIMBUS_ENV_FILE=/abc/def/user1/test/nimbus_env
main/vdnet -c yaml/config.yaml -t ABC...*
my script executes perfectly when run from the shell.I want to execute this script daily and so i have set a cron job for the same by editing crontab -e as :
PATH=/usr/bin:/usr/sbin:.
00 12 * * * /home/test.sh > /home/testCronLog.log 2>&1
main/vdnet: line 2: readlink: command not found
dirname: missing operand
Try 'dirname --help' for more information.
main/vdnet: line 3: /../main/environment: No such file or directory
main/vdnet: line 8: /../scripts/nimbus/setup: No such file or directory
main/vdnet: line 14: /../main/vdNet.pl: No such file or directory
I do not get these errors when I manually execute the script and am not able to figure out whats wrong.The owner of the script is same as the crontab user. Please Help!!!
Upvotes: 0
Views: 1036
Reputation: 11
The issue is now resolved. I added the path to the script before running my command main/vdnet : export PATH=...
Thanks
Upvotes: 1
Reputation: 99
try changing the line which calls vdnet line in test.sh to:
main/vdnet -c /abc/def/user1/testyaml/config.yaml -t ABC...*
Your problem I think is that although test.sh runs perfectly from crontab, main/vdnet does not, and that is because the reference you have supplied it as the argument to the -c option needs the full path.
Upvotes: 0
Reputation: 19733
when you use some command or something, or your script, its always better to give full path
so give full path of main/vdnet
in your script
Upvotes: 0