Last active
February 22, 2022 22:37
-
-
Save takeshixx/7487381 to your computer and use it in GitHub Desktop.
Crontab script for FreeBSD Jails (update seperate ports tree, run portaudit, check for port updates)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/zsh | |
JAIL_PORTS=/usr/jails/ports | |
SHELL=/usr/local/bin/zsh | |
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin | |
SECTION=' * * * * * * ' | |
DELIMITER='------------------------------' | |
portsnap -p $JAIL_PORTS fetch extract &>/dev/null || echo "Updating ports tree failed!" | |
echo "# VULNERABILITIES" | |
echo | |
for jail in $(jails);do | |
JID=$(jid $jail) | |
echo "--- ${jail} ---" | |
jexec $JID pkg audit | |
echo $DELIMITER | |
done | |
echo | |
echo $SECTION | |
echo | |
echo "# AVAILABLE UPDATES" | |
echo | |
for jail in $(jails);do | |
JID=$(jid $jail) | |
echo "--- ${jail} ---" | |
jexec $JID portmaster -L --index-only| egrep '(ew|ort) version|total install' | |
echo $DELIMITER | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment