Skip to content

Instantly share code, notes, and snippets.

@worldwise001
Last active June 13, 2019 04:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save worldwise001/fc16223a7b79c7db676b to your computer and use it in GitHub Desktop.
Save worldwise001/fc16223a7b79c7db676b to your computer and use it in GitHub Desktop.
autoupdate.sh (ArchLinux)
#!/bin/bash
timestamp=`date +%s`
logfile=/var/log/autoupdate/${timestamp}.log
hostname=`hostname`
pacupdate() {
yes | pacman -Scc
yes | pacman -Syu --ignore pacman,glibc,linux-lts,linux-lts-headers,linux,linux-headers,systemd,systemd-sysvcompat,libsystemd --noprogressbar &>> $logfile
yes | pacman -Scc
}
mkdir /var/log/autoupdate > /dev/null 2>&1
echo "=== START UPDATE AT $timestamp ===" > $logfile
echo >> $logfile
timed=$((time pacupdate) 2>&1)
result=$?
echo >> $logfile
echo "Result: $result" >> $logfile
echo "$timed" >> $logfile
echo >> $logfile
echo "=== END UPDATE AT $timestamp ===" >> $logfile
cat $logfile | mail -s "pacman on $hostname" root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment