Skip to content

Commit

Permalink
v6.23
Browse files Browse the repository at this point in the history
+ DietPi-WiFi-Monitor | Do not load globals to reduce RAM usage and loading time a bid
+ DietPi-WiFi-Monitor | RootFS R/W access is not required by this script
+ DietPi-WiFi-Monitor | Allow to pass $TICKRATE to this script, e.g. for testing purpose currently. Possibly pass this via environment variable/file from systemd service in the future, to allow customisation based on end user requirements.
  • Loading branch information
MichaIng authored Apr 26, 2019
1 parent 50d2a1c commit f4f9936
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions rootfs/var/lib/dietpi/services/dietpi-wifi-monitor.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
#!/bin/bash
{

#Import DietPi-Globals ---------------------------------------------------------------
. /DietPi/dietpi/func/dietpi-globals
G_PROGRAM_NAME='DietPi-WiFi-Monitor'
G_CHECK_ROOT_USER
G_CHECK_ROOTFS_RW
G_INIT
#Import DietPi-Globals ---------------------------------------------------------------

#Update network info
# Check for root permissions
(( $UID )) && { echo 'ERROR: Root permissions required. Please run this script with "sudo". Exiting...'; exit 1; }

# Check for concurrent execution
pgrep -f 'dietpi-wifi-monitor.sh' &> /dev/null && { echo 'ERROR: Concurrent execution detected. Please exit the running instance of DietPi-WiFi-Monitor first. Exiting...'; exit 1; }

# Update network info
/DietPi/dietpi/func/obtain_network_details

URL_PING=''
ADAPTER="wlan$(sed -n 2p /DietPi/dietpi/.network)"
TICKRATE=10
TICKRATE={TICKRATE:-10}

#-------------------------------------------------------------------------------------
#Main
# Main
#-------------------------------------------------------------------------------------
# Check for valid WiFi adapter
[[ -e /sys/class/net/$ADAPTER ]] || { echo "ERROR: No valid WiFi adapter found on interface: $ADAPTER. Exiting..."; exit 1; }
Expand Down

0 comments on commit f4f9936

Please sign in to comment.