1847578 Members
3585 Online
110265 Solutions
New Discussion

Re: su - user in script

 
SOLVED
Go to solution
Kevin Wright
Honored Contributor

su - user in script

I am creating a startup script to start a particular application. This app needs to be started by it's owner. When I run this script, it prompts me for the TERM type, as soon as I hit return, it executes correctly. But how can I get it to work without it prompting me for the Term type as this will need to run at bootup??

the relevant part of the script..
case $1 in
start)
if [[ -f /etc/rc.config.d/tidal ]];then
. /etc/rc.config.d/tidal
else
echo "Defaults file /etc/rc.config.d/tidal missing"
fi

if [[ $TD = 1 ]];then
echo "starting tidal server"
su - $USER -c "/opt/ocsagent/bin/express start"
fi;;

Here is the users .profile
#!/bin/ksh
export TERM=hp
export OCS=/opt/ocsagent


5 REPLIES 5
Craig Rants
Honored Contributor

Re: su - user in script

Kevin,
See what happens to that specific user. Are you prompted for the TERM type then? If so you could probably enter that info in the ocsagent .profile and that should take care of you prob.

Good Luck,
C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Sanjay_6
Honored Contributor
Solution

Re: su - user in script

Hi Kevin,

If you manually run the script and it prompts you for TERM type don't worry. If you run the same using the rc script at boottime. it will not prompt you for the TERM type.

Hope this helps.

regds
Craig Rants
Honored Contributor

Re: su - user in script

Didn't see the bottom part, so what if you change the term to something generic like xterm, vt100, or dtterm. What then.
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Roger Baptiste
Honored Contributor

Re: su - user in script

Kevin,

It should work fine in the current format without prompting. I used to have tidal express scheduler in an earlier site and remember running it in the same way .

(hope ocs is more stable now!
if so, some credit for me for reporting endless list of problems ;-) ).

-Raj
Take it easy.
Kevin Wright
Honored Contributor

Re: su - user in script

Ok then, I wasn't sure if it would prompt for the TERM type when the system boots.

Don't know if ocs is more stable or not yet, I just installed it as a client yesterday, but that doesn't sound good.

Thanks for the help.