I can run the following shell script from command prompt as expected:
/bin/sh -xv /home/shantanu/backup_transfer.sh
But when I set it in a cron, it does not execute correctly. There are 2 commands. ssh -t firstname.lastname@example.org "sudo ls" and sudo rsync -avze to another server.
Why would a shell script fail in a cron when it runs successfully at command prompt?
$ which sh /bin/sh
Am I using the correct environment?
Error for the first ssh -t command: Pseudo-terminal will not be allocated because stdin is not a terminal. sudo: sorry, you must have a tty to run sudo Error for the second sudo rsync command: sudo: sorry, you must have a tty to run sudo
No error while running the script at command prompt.