|
@@ -311,6 +311,21 @@ function configure_ssh_onion {
|
311
|
311
|
mark_completed "${FUNCNAME[0]}"
|
312
|
312
|
}
|
313
|
313
|
|
|
314
|
+function check_tor_health {
|
|
315
|
+ { echo '#!/bin/bash';
|
|
316
|
+ echo "status=\$(${PROJECT_NAME}-tor-health)";
|
|
317
|
+ echo "if [[ \"\$status\" == 'G'* ]]; then";
|
|
318
|
+ echo ' exit 0';
|
|
319
|
+ echo 'fi';
|
|
320
|
+ echo "ADMIN_USER=\$(grep \"MY_USERNAME=\" ~/${PROJECT_NAME}.cfg | awk -F '=' '{print \$2}')";
|
|
321
|
+ 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
|
|
322
|
+ chmod +x /usr/bin/check_tor_health
|
|
323
|
+
|
|
324
|
+ if ! grep -q 'check_tor_health' /etc/crontab; then
|
|
325
|
+ cron_add_mins 10 "/usr/bin/check_tor_health"
|
|
326
|
+ fi
|
|
327
|
+}
|
|
328
|
+
|
314
|
329
|
function install_tor {
|
315
|
330
|
if [[ $SYSTEM_TYPE == "mesh*" ]]; then
|
316
|
331
|
return
|