Tiny Core Relay - Modify Cron Logging
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
26985 | |
Production - Fully Tested and Ready for Production | |
Tiny Core Relay - Modify Cron Logging | |
Internal | |
12/6/2022 12:00:00 AM | |
Tiny Core Linux Relay, SSH | |
JulesM on 12/12/2022 8:03:44 AM | |
JulesM on 12/12/2022 8:03:44 AM | |
120 Views / 1 Download | |
![]() ![]() ![]() ![]() ![]() |
Relevance
Used in 2 fixlets | * Results in a true/false |

((if exists property "in proxy agent context" then ( not in proxy agent context ) else true ))
Used in 4 fixlets | * Results in a true/false |

name of operating system contains "Linux TinyCore"
Used in 1 fixlet | * Results in a true/false |

exists lines whose (it contains "/etc/init.d/services/crond") of file "/opt/bootlocal.sh"
Used in 1 fixlet | * Results in a true/false |

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: |