I run this script for updates, it’s done well so far;
#!/bin/bash # SRJ 2019-06-24 # Add the following to /etc/sudoers.d/Update # # Members of the sudo group can install software without giving their password # %sudo * = NOPASSWD: /usr/local/bin/apt, /usr/bin/apt-get, /usr/bin/dpkg # IAM=$(basename "$0") # Name of this script BaseDir="${HOME}/.DailyWork/" # Where to begin putting files Dir=$(date +"${BaseDir}%Y/%m/") # Where to save journal [ -e ${Dir} ] || mkdir -p ${Dir} Now=$(date +%Y-%m-%d-%H-%M) # What is today? Output=$(date +"${Dir}%Y-%m-%d.txt") # Where do we write this data [ -e ${Output} ] && echo '='$_{1..38} >> ${Output} date +"%Y-%m-%d-%H-%M-%S" >> ${Output} sudo apt update |& tee -a ${Output} sudo apt upgrade -y |& tee -a ${Output} sudo apt-get -y autoremove |& tee -a ${Output} if [ -f /var/run/reboot-required ]; then echo 'Reboot required' |& tee -a ${Output} else echo 'No reboot needed' |& tee -a ${Output} fi date +"%Y-%m-%d-%H-%M-%S" >> ${Output} echo ${Now}" Updateing ${HOSTNAME}, output to "${Output} | tee -a ${Output} |