#!/bin/bash

## Copyright (C) 2012 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

#### meta start
#### project Whonix
#### category tor and usability
#### gateway_only yes
#### description
## wrapper to reload Tor
#### meta end

set -x
set -o errexit
set -o nounset
set -o pipefail
set -o errtrace
shopt -s inherit_errexit
shopt -s shift_verbose

cat /etc/motd || true

if leaprun tor-status &>/dev/null ; then
   leaprun reload-tor || true
else
   leaprun restart-tor || true
fi

tor_status_exit_code=0
leaprun tor-status || tor_status_exit_code="$?"
true "${tor_status_exit_code}"

true "Feel free to close this window."

sleep 86400
