I have a script that I use to determine if a Linux server needs to be rebooted or not. Trying to figure out how to create a fixlet or analysis so this is in BigFix.
#!/bin/bash
if [ -f /var/run/reboot-required ]; then
age=$(( $(date +%s) - $(date -r /var/run/reboot-required +%s) ))
echo “1:$age:Restart Required”
else
echo “0:0:No restart required”
fi
I was looking to see if something like this already existed but didn’t see anything in BigFix. I would like to have Linux systems that show relevant to execute the fixlet so they get rebooted.
If you want to test it, create an Analyses and create a Property “Pending Restart” and put the Relevance “pending restart” into it. You can target All Computers with this Relevance.
The ‘pending restart’ inspector will return True if a BigFix action has flagged the system needs a restart (on Linux, we don’t check other places).
If your script is setting that file, you could make a Fixlet relevant by checking
exists file "/var/run/reboot-required"
You could have an Analysis return your results via something like
modification times of files "/var/run/reboot-required"
I tried but failed to create analysis for it. How can I create analysis using “/var/run/reboot-required” or modification times of files “/var/run/reboot-required” for the Linux.
Is it required any specific permission to read the file in Linux ?