1

I have a problem trying to launch a sshpass in a bash script to be launched by cron.

I program the cron:

4 14 14 1 1 /Users/manuel/Downloads/prueba.sh

prueba.sh has this content:

export SSHPASS=mypassword
sshpass -e ssh -oBatchMode=no user@host 'cd www;git pull;exit;'

Then I get:

/Users/manuel/Downloads/prueba.sh: line 3: sshpass: command not found

But if I launch script manually in the terminal, it works. What's the matter?

I tried with the full path of sshpass (/usr/local/bin/sshpass) and with parameter StrictHostKeyChecking=no. I don't know what's my error.

Thanks.

  • The `PATH` environment variable is often different between cron and a normal shell. Are you sure you got the full path correct? 99% sure this is your problem, but using the full path would fix it – Dark Falcon Jan 14 '19 at 13:18
  • I get the full path of sshpass with "which" command. Then I try using this path, /usr/local/bin/sshpass and I get: "Failed to run command: No such file or directory" – Manuel González Burgueño Jan 15 '19 at 07:46

0 Answers0