Last active
June 13, 2019 04:32
-
-
Save worldwise001/fc16223a7b79c7db676b to your computer and use it in GitHub Desktop.
autoupdate.sh (ArchLinux)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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