cron entry to check tor health and report via email
This commit is contained in:
parent
96540317a7
commit
d3869f5350
|
@ -311,6 +311,21 @@ function configure_ssh_onion {
|
|||
mark_completed "${FUNCNAME[0]}"
|
||||
}
|
||||
|
||||
function check_tor_health {
|
||||
{ echo '#!/bin/bash';
|
||||
echo "status=\$(${PROJECT_NAME}-tor-health)";
|
||||
echo "if [[ \"\$status\" == 'G'* ]]; then";
|
||||
echo ' exit 0';
|
||||
echo 'fi';
|
||||
echo "ADMIN_USER=\$(grep \"MY_USERNAME=\" ~/${PROJECT_NAME}.cfg | awk -F '=' '{print \$2}')";
|
||||
echo "tail -n 3 /var/log/tor/notices.log | mail -s \"[${PROJECT_NAME}] Tor status is \$status\" \$ADMIN_USER@\$HOSTNAME"; } > /usr/bin/check_tor_health
|
||||
chmod +x /usr/bin/check_tor_health
|
||||
|
||||
if ! grep -q 'check_tor_health' /etc/crontab; then
|
||||
cron_add_mins 10 "/usr/bin/check_tor_health"
|
||||
fi
|
||||
}
|
||||
|
||||
function install_tor {
|
||||
if [[ $SYSTEM_TYPE == "mesh*" ]]; then
|
||||
return
|
||||
|
|
|
@ -971,6 +971,9 @@ function setup_utils {
|
|||
function_check install_tor
|
||||
install_tor
|
||||
|
||||
function_check check_tor_health
|
||||
check_tor_health
|
||||
|
||||
function_check install_command_line_browser
|
||||
install_command_line_browser
|
||||
|
||||
|
|
Loading…
Reference in New Issue