Skip to content

Commit

Permalink
suspend-pre/post: stop/restart both, tor and vanguards systemd unit
Browse files Browse the repository at this point in the history
  • Loading branch information
adrelanos committed Sep 23, 2022
1 parent 515e23e commit 32916fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 3 additions & 7 deletions usr/libexec/sdwdate/suspend-post
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,15 @@ tor_restart_maybe() {
if test -f /run/sdwdate/tor_was_running.status ; then
output_cmd_func "INFO - Yes, file /run/sdwdate/tor_was_running.status exists."

output_cmd_func "INFO: - Deleting Tor consensus files..."
output_cmd_func "INFO: - Deleting Tor consensus files, restart vanguards and Tor..."
## Without this, Tor keeps the stale Tor consensus even after restarting Tor.
## provided by package helper-scripts
anon-consensus-del-files
output_cmd_func "INFO: - Done, deleted Tor consensus files."
anon-consensus-del
output_cmd_func "INFO: - Done, deleted Tor consensus files, restarted vanguards and Tor."

output_cmd_func "INFO - Deleting /run/sdwdate/tor_was_running.status..."
rm --force /run/sdwdate/tor_was_running.status
output_cmd_func "INFO - Done, deleted /run/sdwdate/tor_was_running.status."

output_cmd_func "INFO - Restarting Tor..."
systemctl --no-pager restart tor
output_cmd_func "INFO - Done, restarted Tor."
else
output_cmd_func "INFO - No, file /run/sdwdate/tor_was_running.status did not exist, meaning we previously before suspend/hibernate did not stop Tor, therefore not starting it now."
fi
Expand Down
4 changes: 4 additions & 0 deletions usr/libexec/sdwdate/suspend-pre
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ if systemctl --no-pager status tor >/dev/null ; then
output_cmd_func "INFO - Stopping Tor..."
systemctl --no-pager stop tor
output_cmd_func "INFO - Done, stopped Tor."

output_cmd_func "INFO - Stopping vanguards..."
systemctl --no-pager stop vanguards || true
output_cmd_func "INFO - Done, stopped vanguards."
else
output_cmd_func "INFO - Tor was not running, no need to stop it."
fi
Expand Down

0 comments on commit 32916fc

Please sign in to comment.