A FreeBSD oneliner this time.
This won’t work on Linux!
Tools like portmaster and portupgrade allow you to update all installed ports/packages in a single run, which is great.
But these tools do not list the ports and packages that have been upgraded, leaving you to guess which daemons and services must be restarted…
Luckily, all installed packages are registered in an SQLite database, together with a timestamp for their last upgrade (or installation). Add the following alias to your ~/.bashrc:
alias puptd='sqlite3 /var/db/pkg/local.sqlite "select origin from packages where time > $(date -j +%s 0500) order by origin"'
Clearly, if you don’t use the Bash shell, you should figure out how to add aliases in your shell. The alias will be active after you re-login; invoke it like any other command.
This alias will list all ports/packages that were updated (or installed) after 5 o’clock this morning; it’s quite rare that I start work before 5, but obviously you should feel free to change the 0500 to any other time (in 24-hour format). You can then check the list to see if any services must be restarted, configurations must be verified, etc.
If you’re going to play around with that database to see what other info you can extract from it, you should probably make a copy of it, to make sure you don’t accidentally write to the original; you don’t want to mess up your package database.
P.s.: the name for the alias comes from ‘Ports UPdated ToDay’; change it to anything you like.