# Hotspot Auto User logout user When internet Down - Mikrotik Script RouterOS

    Hotspot Auto User logout user When internet Down

    This script is useful for automatic user logout and cookies when the internet is down or totally dead

    1. Open Winbox, Click Tools> Netwatch
    2. Click the "+" sign to add a new item
    3. Host: enter the ip address which is rarely down for example Google DNS 8.8.8.8
    4. Click the Down tab
    5. then enter in On Down: with the script below

    # SCRIPT REMOVE USER ACTIVE
    :local activelist [/ip hotspot active find]
    :foreach i in=$activelist do={
        /ip hotspot active remove $i
    }

    # SCRIPT REMOVE COOKIE ACTIVE
    :local activelist [/ip hotspot cookie find]
    :foreach i in=$activelist do={
        /ip hotspot cookie remove $i
    }
    Credit: www.o-om.com