Bug 101408 - daemon --user option does not work from cron (su: standard in must be a tty)
Summary: daemon --user option does not work from cron (su: standard in must be a tty)
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 7.2
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-07-31 18:48 UTC by Vilius Puidokas
Modified: 2014-03-17 02:37 UTC (History)
1 user (show)

Fixed In Version: FC4
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-09-30 19:11:55 UTC
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.