Bug 101408

Summary: daemon --user option does not work from cron (su: standard in must be a tty)
Product: [Retired] Red Hat Linux Reporter: Vilius Puidokas <knopka>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED CURRENTRELEASE QA Contact: Brock Organ <borgan>
Severity: low Docs Contact:
Priority: medium    
Version: 7.2CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: FC4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-30 19:11:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Vilius Puidokas 2003-07-31 18:48:07 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b)
Gecko/20030516 Mozilla Firebird/0.6

Description of problem:
i was working on a startup script for our homegrown daemon and realized that
--user option seems to get broken if script is invoked from crond.

looks like it's su which doesn't like non tty stdin. any ideas how can this be
fixed? i assume 'su' has a valid reason here.

 workaround: make daemon change uid.

syslog:
Jul 30 23:55:01 xxx draft-robot: draft-robot shutdown succeeded
Jul 30 23:55:01 xxx su: standard in must be a tty
Jul 30 23:55:01 xxx draft-robot: baseball startup failed

and cronjob output:
Starting up draft-robot [baseball]standard in must be a tty
[FAILED]
[FAILED]


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. call from cron: daemon --user=foo "sleep 60 &"
2. 
3.
    

Additional info:

Comment 1 Vilius Puidokas 2003-07-31 21:32:29 UTC
source of trouble seems to be /sbin/initlog;

also, enhanced logic might be acceptable in daemon():

iam=`id -un`
if [ -z "$user" -o "$iam" = "$user" ]; then


Comment 2 Bill Nottingham 2005-09-30 19:11:55 UTC
Closing bugs on older, no longer supported, releases. Apologies for any lack of
response.

Current releases, such as FC4 a) use 'runuser' b) don't use 'initlog'.

Ergo, this should be solved.