First of all make sure you know which system is generating the error (the host running HAAst, or the host which the post-sync script is connecting to). That may change the answer, and/or where you need to apply changes.
One of these solutions should help:
- Try adding the “-t” parameter to the ssh command to create a pseudo terminal for the command to run in.
- Instead of “-t” try “-tt” to force a tty (even if ssh has no local tty).
- Remove sudo completely from the command in your bash script. Since the HAAst (service) runs as root the processes it forks also run as root (unless the system is further locked down). Assuming error is locally generated.
- Comment out the line “Defaults requiretty” in the /etc/sudoers file. Then sudo won’t require a TTY anymore for sudo commands. (But undstand security implications).
- Use the “su –c” command instead of sudo