|
1 | 1 | # autoupdater
|
2 |
| -autoupdater is a systemd service that runs on a systemd.timer to automatically run apt update, upgrade, autoremove, and autoclean. on a schedule. This service will be provided as a deb package and should be apt installable at some point in the future. |
| 2 | +Autoupdater uses systemd to automatically run apt-get update, upgrade, autoremove, and autoclean to update Ubuntu/Debian-based systems on a schedule. |
| 3 | + |
| 4 | +The provided deb package will install 3 files on your system |
| 5 | + |
| 6 | +- /usr/bin/autoupdater |
| 7 | +This is the script that the service runs to execute the apt-get commands. |
| 8 | +This script takes the following switches, which are passed to it by the service: |
| 9 | +``` |
| 10 | + -a automatically reboot if needed (does not reboot by default) |
| 11 | + -r when to reboot if needed (now, 3:00 (3am on 24 hr clock), 18:00 (6pm on 24 hr clock), +2h) |
| 12 | + -m do not run autoremove (runs by default) |
| 13 | + -c do not run clean (runs by default) |
| 14 | +``` |
| 15 | +- /lib/systemd/system/autoupdater.service |
| 16 | +This service file does not execute on it's own, but is instead executed by the timer file. |
| 17 | +You can modify this service file to change the options that are passed to the script. |
| 18 | +When this service is started, it runs /usr/bin/autoupdater with the specified switches and then exits on completion. |
| 19 | + |
| 20 | +- /lib/systemd/system/autoupdater.timer |
| 21 | +The timer file is responsible for starting the service on a schedule. There are two options you can change here. The values shown are the current defaults. |
| 22 | +``` |
| 23 | +# Time to wait after booting before we run first time |
| 24 | +OnBootSec=10min |
| 25 | +# Time between running each consecutive time |
| 26 | +OnUnitActiveSec=12h |
| 27 | +``` |
| 28 | + |
| 29 | +If you make changes to any of these files, you will need to run this afterwards: |
| 30 | + |
| 31 | + sudo systemctl daemon-reload |
| 32 | + |
| 33 | + |
| 34 | +### Installation |
| 35 | +The simplest way to install is using the provided deb package: |
| 36 | +```bash |
| 37 | +sudo dpkg -i autoupdater.deb |
| 38 | +``` |
| 39 | +To uninstall the service: |
| 40 | +```bash |
| 41 | +sudo dpkg -P autoupdater |
| 42 | +``` |
| 43 | + |
| 44 | + |
| 45 | +### Logging |
| 46 | +Systemd logs to the built in journal by default, and all writes to stdout are visible in the journal. |
| 47 | +To view the logs for this service: |
| 48 | +```bash |
| 49 | +journalctl -u autoupdater.service |
| 50 | +``` |
| 51 | + |
| 52 | +You can also view the current state of the service by running: |
| 53 | +```bash |
| 54 | +systemctl autoupdater status |
| 55 | +``` |
0 commit comments