User story #3944
closedPrevent the /etc/cron.d/rudder-agent script from sending unsollicited e-mails
Description
Hello
We noticed that after rudder is installed inside a server this file is created:
cat /etc/cron.d/rudder-agent # Cron file for Rudder # # Will manually run cf-agent in case cf-execd is no longer running. cf-agent will fire up a new cf-execd. # # To temporarily avoid this behaviour, touch /opt/rudder/etc/disable-agent. # Don't forget to remove that file when you're done! 0,5,10,15,20,25,30,35,40,45,50,55 * * * * root if [ ! -e /opt/rudder/etc/disable-agent -a `ps -efww | grep -E "(cf-execd|cf-agent)" | grep -E "/var/rudder/cfengine-community/bin/(cf-execd|cf-agent)" | grep -v grep | wc -l` -eq 0 ]; then /var/rudder/cfengine-community/bin/cf-agent -f failsafe.cf && /var/rudder/cfengine-community/bin/cf-agent; fi
The problem is that the cron is sometime generating some output and a email is sent to administrator of that server. We would like to avoid this by appending : > /dev/null 2>&1 at the end of cron entry.
Unfortunately we didn't find a way to do it. We tried to do it by adding a technique to System settings-> System management->Cron daemon configuration -> and adding the appropriate content to the file , also by enforcing file content technique in Distributing files ->Enforce file content but each time the file was getting change each time the cron was running thus creating lots of files in /var/rudder/modified-files. Can you tell us which is the appropriate way to do this ?
The output of manually running the agent is similar to this
R: @@Common@@log_info@@hasPolicyServer-root@@common-root@@77@@common@@StartRun@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#Start execution R: @@Common@@result_success@@hasPolicyServer-root@@common-root@@77@@Update@@None@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#Policy and dependencies already up to date. No action required. !! Method invoked repairs R: @@Common@@result_success@@hasPolicyServer-root@@common-root@@77@@Security parameters@@None@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#The internal environment security is acceptable R: @@Common@@result_success@@hasPolicyServer-root@@common-root@@77@@Red Button@@None@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#Red Button is not in effect, continuing as normal... -> Edited file /etc/cron.d/rudder-agent R: @@Common@@result_success@@hasPolicyServer-root@@common-root@@77@@Process checking@@None@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#There is an acceptable number of CFEngine processes running on the machine R: @@Common@@result_success@@hasPolicyServer-root@@common-root@@77@@CRON Daemon@@None@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#The CRON daemon is running R: @@Common@@result_success@@hasPolicyServer-root@@common-root@@77@@Binaries update@@None@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#The CFengine binaries in /var/rudder/cfengine-community/bin are up to date R: @@Common@@log_info@@hasPolicyServer-root@@common-root@@77@@Log system for reports@@None@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#Detected running syslog as rsyslog R: @@Common@@result_success@@hasPolicyServer-root@@common-root@@77@@Log system for reports@@None@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#Logging system for report centralization is already correctly configured -> Executing '/usr/bin/curl -s -f --proxy '' -o "/var/rudder/tmp/uuid.txt" http://1.2.3.4/uuid' ... (no timeout) -> Completed execution of /usr/bin/curl -s -f --proxy '' -o "/var/rudder/tmp/uuid.txt" http://1.2.3.4/uuid R: @@Inventory@@result_success@@inventory-all@@inventory-all@@72@@inventory@@None@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#Next inventory scheduled between 00:00 and 06:00 -> Edited file /etc/cron.d/rudder-agent Moved /etc/cron.d/rudder-agent_1379590921_Thu_Sep_19_12_42_02_2013.cf-before-edit to repository location /var/rudder/modified-files/_etc_cron_d_rudder_agent_1379590921_Thu_Sep_19_12_42_02_2013_cf_before_edit R: @@checkGenericFileContent@@result_repaired@@fa21718e-c620-4cd1-9937-820eb537cb2e@@e7425d44-39af-4ee2-ad1a-5530cec86098@@4@@File@@/etc/cron.d/rudder-agent@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#The file /etc/cron.d/rudder-agent was successfully updated R: @@checkGenericFileContent@@result_success@@fa21718e-c620-4cd1-9937-820eb537cb2e@@e7425d44-39af-4ee2-ad1a-5530cec86098@@4@@Line deletion regular expressions@@/etc/cron.d/rudder-agent@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#The file /etc/cron.d/rudder-agent was not set for any line deletion R: @@checkGenericFileContent@@result_success@@fa21718e-c620-4cd1-9937-820eb537cb2e@@e7425d44-39af-4ee2-ad1a-5530cec86098@@4@@Line replacement regular expressions@@/etc/cron.d/rudder-agent@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#The file /etc/cron.d/rudder-agent was not set for any line replacement R: @@checkGenericFileContent@@result_success@@fa21718e-c620-4cd1-9937-820eb537cb2e@@e7425d44-39af-4ee2-ad1a-5530cec86098@@4@@Permission adjustment@@/etc/cron.d/rudder-agent@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#The file /etc/cron.d/rudder-agent uses default permissions R: @@checkGenericFileContent@@result_success@@fa21718e-c620-4cd1-9937-820eb537cb2e@@e7425d44-39af-4ee2-ad1a-5530cec86098@@4@@Post-modification hook@@/etc/cron.d/rudder-agent@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#No command for /etc/cron.d/rudder-agent was to be executed R: @@Common@@log_info@@hasPolicyServer-root@@common-root@@77@@common@@EndRun@@2013-09-19 12:42:01+01:00##ee35116e-6a31-4416-9f68-d4c8a286b076@#End execution