Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use timer for RP update check instead of apt hook #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion install-update-tracker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ case "$INSTALLER" in
apt)

# The total number of steps in the installation process
TOTAL_STEPS="3"
TOTAL_STEPS="4"

# Install dependencies
progress 1 "Installing dependencies..."
Expand All @@ -143,8 +143,18 @@ case "$INSTALLER" in
{ sudo mv "$PACKAGE_FILES_PATH/apt/apt-metrics.sh" "$UPDATE_SCRIPT_PATH" || fail "Could not move apt update collector."; } >&2
{ sudo mv "$PACKAGE_FILES_PATH/rp-version-check.sh" "$UPDATE_SCRIPT_PATH" || fail "Could not move Rocket Pool update collector."; } >&2
{ sudo mv "$PACKAGE_FILES_PATH/apt/apt-prometheus-metrics" "/etc/apt/apt.conf.d/60prometheus-metrics" || fail "Could not move apt trigger."; } >&2
{ sudo mv "$PACKAGE_FILES_PATH/apt/rp-check.sh" "$UPDATE_SCRIPT_PATH" || fail "Could not move Rocket Pool update tracker script."; } >&2
{ sudo mv "$PACKAGE_FILES_PATH/apt/rp-update-tracker.service" "/etc/systemd/system" || fail "Could not move update tracker service."; } >&2
{ sudo mv "$PACKAGE_FILES_PATH/apt/rp-update-tracker.timer" "/etc/systemd/system" || fail "Could not move update tracker timer."; } >&2
{ sudo chmod +x "$UPDATE_SCRIPT_PATH/apt-metrics.sh" || fail "Could not set permissions on apt update collector."; } >&2
{ sudo chmod +x "$UPDATE_SCRIPT_PATH/rp-version-check.sh" || fail "Could not set permissions on Rocket Pool update collector."; } >&2
{ sudo chmod +x "$UPDATE_SCRIPT_PATH/rp-check.sh" || fail "Could not set permissions on Rocket Pool update tracker script."; } >&2

# Install the update checking service
progress 4 "Installing Rocket Pool update tracker service..."
{ sudo systemctl daemon-reload || fail "Couldn't update systemctl daemons."; } >&2
{ sudo systemctl enable rp-update-tracker || fail "Couldn't enable update tracker service."; } >&2
{ sudo systemctl start rp-update-tracker || fail "Couldn't start update tracker service."; } >&2

;;

Expand Down
2 changes: 0 additions & 2 deletions rp-update-tracker/apt/apt-prometheus-metrics
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
APT::Update::Post-Invoke-Success {
"/usr/share/apt-metrics.sh | sponge /var/lib/node_exporter/textfile_collector/apt.prom || true";
"/usr/share/rp-version-check.sh | sponge /var/lib/node_exporter/textfile_collector/rp.prom || true";
};

DPkg::Post-Invoke {
"/usr/share/apt-metrics.sh | sponge /var/lib/node_exporter/textfile_collector/apt.prom || true";
"/usr/share/rp-version-check.sh | sponge /var/lib/node_exporter/textfile_collector/rp.prom || true";
};
3 changes: 3 additions & 0 deletions rp-update-tracker/apt/rp-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

/usr/share/rp-version-check.sh | sponge /var/lib/node_exporter/textfile_collector/rp.prom || true
10 changes: 10 additions & 0 deletions rp-update-tracker/apt/rp-update-tracker.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Checks for Rocket Pool updates periodically
Wants=rp-update-tracker.timer

[Service]
Type=oneshot
ExecStart=/usr/share/rp-check.sh

[Install]
WantedBy=multi-user.target
10 changes: 10 additions & 0 deletions rp-update-tracker/apt/rp-update-tracker.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Timer for the Rocket Pool updates tracker
Requires=rp-update-tracker.service

[Timer]
Unit=rp-update-tracker.service
OnCalendar=*-*-* *:00:00

[Install]
WantedBy=timers.target