Bug 500694

Summary: cronie don't use environment from /etc/crontab
Product: [Fedora] Fedora Reporter: Remi Collet <fedora>
Component: anacronAssignee: Marcela Mašláňová <mmaslano>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: mmaslano, pertusus, tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-15 12:01:18 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 Remi Collet 2009-05-13 17:54:37 UTC
cronie-1.2-7.fc11.x86_64

According to man page

"PAM Access Control: On Red Hat systems, crond now supports access control with PAM - see pam(8).  A PAM configuration file for crond is installed in  /etc/pam.d/crond.  crond loads the PAM environment from the pam_env module, but these can be overriden by settings in the crontab file."

Standard installation :
/etc/security/pam_env.conf is empty (only comments)
/etc/environment is empty
/etc/crontab :

   SHELL=/bin/bash
   PATH=/sbin:/bin:/usr/sbin:/usr/bin
   MAILTO=root
   HOME=/

But for running task :

   PATH=/usr/bin:/bin
   SHELL=/bin/sh

So I think value should be taken from /etc/crontab.
What did I miss ?

Comment 1 Tomas Mraz 2009-05-13 19:52:01 UTC
I suppose that you're editing either user's crontab with crontab -e or some crontab in /etc/cron.d/ directory. Each crontab is individual and the environment variables specified in that crontab apply only to that crontab.

Comment 2 Remi Collet 2009-05-14 04:58:47 UTC
No, it's a /etc/cron.hourly script (provided by ocsinventory-agent rpm, which need /sbin in path).

Where is defined the defaut environment for it ?

- Previously, hourly task where launch by "run-parts" in /etc/crontab, so use the env. defined there

- It seems it is now launched by /etc/cron.d/0hourly where there is no env. defined

This seems to explain the difference between F10/F11 which can be consider as a "regresion".

I don't have done any test for daily/monthly script, but it could be a solution to add same env. in /etc/cron.d/0hourly that in /etc/crontab to keep same behaviour than in previous release.

Regards

Comment 3 Tomas Mraz 2009-05-14 06:46:16 UTC
Yes, that's a good idea.

Comment 4 Marcela Mašláňová 2009-05-15 12:01:18 UTC
The cron man page will be updated and cron jobs in anacron package has environment values now.

Comment 5 Fedora Update System 2009-06-09 14:34:55 UTC
anacron-2.3-75.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/anacron-2.3-75.fc11

Comment 6 Fedora Update System 2009-06-18 11:50:28 UTC
anacron-2.3-75.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.