From d7428e40e376d33ff129029fc406b75ac13f3343 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 27 Apr 2025 01:34:22 -0700 Subject: [PATCH] Create _enable_network_activity_monitor() + _symlink_net_activity() --- installers/common.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/installers/common.sh b/installers/common.sh index a6a56261..59642605 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -75,6 +75,7 @@ function _update_raspap() { _download_latest_files _change_file_ownership _patch_system_files + _symlink_net_activity _create_plugin_scripts _install_complete } @@ -818,9 +819,32 @@ function _configure_networking() { echo -e _enable_raspap_daemon fi + + # Enable RaspAP network activity monitor + _enable_network_activity_monitor + _install_status 0 } +# Install and enable RaspAP network activity monitor +function _enable_network_activity_monitor() { + _install_log "Enabling RaspAP network activity monitor" + sudo cp $webroot_dir/installers/network-activity.sh "$raspap_dir/hostapd" || _install_status 1 "Unable to copy network-activity.sh" + sudo cp $webroot_dir/installers/raspap-network-activity@.service /lib/systemd/system/ || _install_status 1 "Unable to move raspap-network-activity.service file" + sudo systemctl daemon-reload + sudo systemctl enable raspap-network-activity@wlan0.service || _install_status 1 "Failed to enable raspap-network-activity.service" + sudo systemctl start raspap-network-activity@wlan0.service || _install_status 1 "Failed to start raspap-network-activity.service" + sleep 0.5 + _symlink_net_activity + echo "Network activity monitor enabled" +} + +function _symlink_net_activity() { + echo "Symlinking /dev/shm/net_activity to $webroot_dir/app/net_activity" + sudo ln -sf /dev/shm/net_activity $webroot_dir/app/net_activity || _install_status 1 "Failed to link net_activity to ${webroot_dir}/app" + sudo chown -R $raspap_user:$raspap_user $webroot_dir/app/net_activity || _install_status 1 "Unable to set ownership of ${webroot_dir}/app/net_activity" +} + # Prompt to configure TCP BBR option function _prompt_configure_tcp_bbr() { _install_log "Configure TCP BBR congestion control"