Bash & 'su' script giving an error "standard in must be a tty".
- by sHz
Folks, I'm having an issue with a bash script which runs a particular command as a different user.
The background: Running on a Linux box (CentOS), the script is quite simple, its starting the hudson-ci application.
declare -r HOME=/home/hudson
declare -r RUNAS=hudson
declare -r HOME=/home/hudson
declare -r LOG=hudson.log
declare -r PID=hudson.pid
declare -r BINARY=hudson.war
su - ${RUNAS} -c "nohup java -jar ${HOME}/${BINARY} >> ${HOME}/${LOG} 2>&1; echo $! > ${HOME}/${PID}" &
This is the bridged version of the script, when run, the script exists with "standard in must be a tty". Any ideas on what I could be doing wrong? I've tried Dr Google and all the advise hasn't helped thus far.