SlackwareSlackpkgOneLiner

How to run slackpkg to check for updates

Let me be honest: slackpkg is the greatest thing to happen to Slackware since it was created by Pat Volkerding!

Presented without further ado, here is the script that I use to maintain my Slackware server up-to-date and squeaky shiny clean:

#!/usr/bin/bash

# ##############################################################
# #
# # verif_maj.sh                Check if there are patches
# #
# # Put this script in the crontab of your server
# #
# ##############################################################

# ##############################################################
# #
# # Version/History
# # ---------------
# #
# # Mon May 27 16:25:15 CEST 2013       v0.0    first version
# #
# ##############################################################

# check and send email only if necessary

sudo /usr/sbin/slackpkg check-updates | grep -i no.news || echo "Updates are available for this machine. \
                                        Please run sudo /usr/sbin/slackpkg update at your earliest convenience" \
                                        | mailx -s "slackpkg check for $(hostname) ($(date))" your_address_here@localhost

exit 0

# end of script.

Please note that the one long line has been split in the example above.

Just a few things to be noted here:

00 8 * * * /home/gil/bin/verif_maj.sh
User_Alias      SYSOP = gil
Cmnd_Alias      SCAN = /usr/local/bin/nmap, /bin/netstat, /usr/sbin/slackpkg
Runas_Alias     ADMIN = root
SYSOP           ALL=(ADMIN) NOPASSWD: SCAN

Hope this helps!