Running Capistrano from cron or FreeBSD’s periodic can be tricky—both (wisely) limit your environment. Scripts may run just fine in a SSH session, but fail when run by cron.A couple of standard gotchas:
- Command not found: your PATH is usually chopped down. Either explicitly set PATH to include you commands, or execute commands with their full paths.
- No terminal. On Linux, try sudo’s -i option.
More puzzling:connection failed for: example.com (RuntimeError: can’t get terminal parameters (Inappropriate ioctl for device))I assumed this was a tty/SSH/login session problem. Turns out it was a permissions problem. The current user couldn’t login to the remote server via SSH, and the remote server was prompting for a password. Of course, it worked when running this script by hand.