Created
December 10, 2018 13:21
-
-
Save tormath1/18893bdf22ea97b94f73b04fbc5f9df7 to your computer and use it in GitHub Desktop.
automagically update your 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
# /etc/systemd/system/update.timer | |
[Unit] | |
Description=Perform a full upgrade once a week (at 12:00pm on Monday) | |
[Timer] | |
OnCalendar=Mon *-*-* 12:00:00 | |
Persistent=true | |
[Install] | |
WantedBy=timers.target | |
# /etc/systemd/system/update.service | |
[Unit] | |
Description=Upgrade system | |
ConditionACPower=false | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/local/bin/update.sh | |
After=network-online.target | |
Wants=network-online.target | |
# /usr/local/bin/update.sh | |
#!/bin/bash | |
echo "waiting for internet avaibility..." | |
ping google.com -c 2 > /dev/null 2>&1 | |
while [ $? -ne 0 ];do | |
ping google.com -c 2 > /dev/null 2>&1 | |
done | |
echo "[OK] connected" | |
echo "starting update..." | |
pacman -Syyuu --noconfirm > /dev/null 2>&1 | |
echo "[OK] update completed" | |
echo "Have a great day :)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment