Tiny Core Relay - Modify Cron Logging
Log In or Register to download the BES file, and more.

0 Votes

Description

On VRAs where frequent cronjobs are run, the sys log will fill up with cron entries making the sys log more difficult to parse. 

By default Cron logs all messages to /var/log/messages. This fixlet will change the cron message location to a separate file.

Implementation:

- This is only relevant on VRAs that already have crond set to start on boot.
- Creates a new file: /var/log/cron.log
- Edits the crond init script to set the new log location
- Adds the crond init script to the filetool
- Runs a filetool backup


Property Details

ID26985
StatusProduction - Fully Tested and Ready for Production
TitleTiny Core Relay - Modify Cron Logging
SourceInternal
Source Release Date12/6/2022 12:00:00 AM
KeywordsTiny Core Linux Relay, SSH
Added by on 12/12/2022 8:03:44 AM
Last Modified by on 12/12/2022 8:03:44 AM
Counters 120 Views / 1 Download
User Rating 1 star 2 star 3 star 4 star 5 star * Average over 0 ratings. ** Log In or Register to add your rating.

Relevance

Used in 5 fixlets   * Results in a true/false
Show indented relevance
(exists relay service)
Used in 2 fixlets   * Results in a true/false
Show indented relevance
((if exists property "in proxy agent context" then ( not in proxy agent context ) else true ))
Used in 4 fixlets   * Results in a true/false
Show indented relevance
name of operating system contains "Linux TinyCore"
Used in 1 fixlet   * Results in a true/false
Show indented relevance
exists lines whose (it contains "/etc/init.d/services/crond") of file "/opt/bootlocal.sh"
Used in 1 fixlet   * Results in a true/false
Show indented relevance
not exists lines whose (it contains "crond -L /var/log/cron.log") of file "/etc/init.d/services/crond"

Actions

Action 1 (default)

Action Link Click here to deploy this action.
Script Type BigFix Action Script
//Create cron log and add write permissions

if {not exists file "/var/log/cron.log"}

wait touch /var/log/cron.log
wait chmod 660 /var/log/cron.log

endif

//Create crond configuration script
delete __createfile
createfile until endofscript1
#!/bin/sh

#Set Variables

LOGFILE=/var/log/cron.log
CRONDSTAT=$(pidof crond)

#Set output suppression function

quiet()
{{
"$@" > /dev/null 2>&1
}

#Create Log File

touch $LOGFILE

#Edit Crond Init Script - Add options to crond start command

quiet sed -i 's/^\s*crond/\t\tcrond -L \/var\/log\/cron.log/' /etc/init.d/services/crond

#Add Crond Init Script to Filetool.lst

echo "etc/init.d/services/crond" >> /opt/.filetool.lst

#Run Filetool backup

quiet sudo filetool.sh -b

#Restart crond

if [ -n "$CRONDSTAT" ]; then
    quiet /etc/init.d/services/crond stop
    quiet /etc/init.d/services/crond start
else
    quiet /etc/init.d/services/crond start
fi
endofscript1

delete /var/opt/BESClient/cronlogconfig.sh
move __createfile /var/opt/BESClient/cronlogconfig.sh
wait chmod 550 /var/opt/BESClient/cronlogconfig.sh
wait /bin/sh /var/opt/BESClient/cronlogconfig.sh
Success Criteria

This action will be considered successful when the applicability relevance evaluates to false.


Sharing

Social Media:
Share this page on Yammer

Comments

Log In or Register to leave comments!