Skip to content

Instantly share code, notes, and snippets.

@takeshixx
Last active February 22, 2022 22:37
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save takeshixx/7487381 to your computer and use it in GitHub Desktop.
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)
#!/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