Contains several scripts that can show information in the XFCE4 task bar (current IPs, plain output of a website, number of queued mails), and enables users to execute various actions (switch the computer to an "offline mode", send enqueued emails).
移至檔案
mxmehl f9819b3ed5 deprecate wget, use curl instead 2024-02-29 11:48:04 +01:00
.gitignore initial commit 2016-07-29 19:08:33 +02:00
LICENSE add license 2016-07-29 19:09:21 +02:00
README.md fix typo 2017-01-10 01:33:15 +01:00
config.cfg.sample adding function to switch DNS nameservers + monitoring of current settings; adding a README 2016-12-26 15:30:59 +01:00
fsfe-build.php add php/sh scripts to show build status 2018-05-15 08:30:24 +02:00
fsfe-build.sh deprecate wget, use curl instead 2024-02-29 11:48:04 +01:00
msmtp-handler.sh adding msmtp-queue-handler depending on off/on status; make msmtp-queue paths configurable; reset counter when queue=0 2016-11-23 12:44:29 +01:00
shared-functions.so improve selective status update which makes most preset values unnecessary 2016-12-26 15:10:29 +01:00
status-interaction.sh adding function to switch DNS nameservers + monitoring of current settings; adding a README 2016-12-26 15:30:59 +01:00
status-ip.sh deprecate wget, use curl instead 2024-02-29 11:48:04 +01:00
status-misc.sh deprecate wget, use curl instead 2024-02-29 11:48:04 +01:00

README.md

Dynamic Status

These scripts control and monitor several functions of my computer. Most importantly it is possible to switch to a "offline status" which disables several internet-using monitoring functions.

status-ip.sh and status-misc.sh rely on xfce-genmon-plugin to show some status messages on the XFCE task bars.

status-interaction.sh enables users to actively change some values, e.g. the on-/offline status, the used DNS nameserver, and to trigger some actions, e.g. to send mails in an msmtp queue.

I tried to make it as compatible to as many systems as possible but some values are still hard-coded.

DNS nameserver switch

This feature heavily depends on network-manager and its dispatcher feature. In order to use it, put a file in /etc/NetworkManager/dispatcher.d/ and name it 90-custom-resolv.conf for example. Fill it:

#!/bin/bash
#
# Depending on dynamic status, override /etc/resolv.conf

CUSTOM=/tmp/resolv_custom.conf
DEFAULT=/home/user/bin/default-nameserver.sh

if [ ! -e $CUSTOM ]; then  # if file does not exists, use default nameserver script
  bash $DEFAULT
  echo "# 90-custom-resolvconf executed default-nameserver.sh" >> /etc/resolv.conf
  exit 0
fi

SET=$(cat $CUSTOM | head -n1 | awk '{print $NF}')  # first line, last word

if [ "$SET" != "auto" ]; then
  cp -f /etc/resolv.conf /etc/resolv.conf.bak   # backup original resolv config file
  cat $CUSTOM > /etc/resolv.conf  # use custom file, update original one 
else
  echo "# 90-custom-resolvconf didn't change any substantial values here, just added this line." >> /etc/resolv.conf
fi

The file has to be owned by root and be executable in order to function. It will either execute a script that sets default nameserver settings (in my case, it's localhost since I use a local dnsmasq), or take the values from another file which is created by switching the nameservers with status-interaction.sh.

Nameservers can be configured in config.cfg as value of NS=. It holds following pattern:

set1(ip1,ip2,ip3)|set2(ip4,ip5)

Please remember to put it between quotes.