Red Hat Bugzilla – Bug 101408
daemon --user option does not work from cron (su: standard in must be a tty)
Last modified: 2014-03-16 22:37:51 EDT
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.
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
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. call from cron: daemon --user=foo "sleep 60 &"
source of trouble seems to be /sbin/initlog;
also, enhanced logic might be acceptable in daemon():
if [ -z "$user" -o "$iam" = "$user" ]; then
Closing bugs on older, no longer supported, releases. Apologies for any lack of
Current releases, such as FC4 a) use 'runuser' b) don't use 'initlog'.
Ergo, this should be solved.