Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login
    Introducing Netgate Nexus: Multi-Instance Management at Your Fingertips.

    Cron captive portal disconnect all user

    Scheduled Pinned Locked Moved Captive Portal
    2 Posts 2 Posters 805 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      mohamed.elkhateeb
      last edited by

      Cron captive portal disconnect all user

      GertjanG 1 Reply Last reply Reply Quote 0
      • GertjanG Online
        Gertjan @mohamed.elkhateeb
        last edited by Gertjan

        @mohamed-elkhateeb

        Has been published here on the (this) forum.
        Sorry, my search button is out for the day.

        edit : and repaired.
        Here it is :

        #!/usr/local/bin/php -q
        <?php
        	/* Disconnect all clients on all captive portal instances */
        
        	require_once("/etc/inc/util.inc");
        	require_once("/etc/inc/functions.inc");
        	require_once("/etc/inc/captiveportal.inc");
        
        	global $g, $config, $cpzone, $cpzoneid;
        
        	/* Are there any portals  ? */
        	if (is_array($config['captiveportal'])) {
        		/* For every portal (cpzone), do */
        		foreach ($config['captiveportal'] as $cpkey => $cp)
        			/* Sanity check */
        			if (is_array($config['captiveportal'][$cpkey])) 
        				/* Is zone enabled ? */
        				if (array_key_exists('enable', $config['captiveportal'][$cpkey])) {
        					$cpzone = $cpkey;
        					$cpzoneid = $cp['zoneid'];
        					captiveportal_disconnect_all();
        				}
        	}
        ?>
        

        Place the file with extension php in, for example, /root/

        Make a cron entry like

        59ff7d41-7aca-437c-82ac-c241dfa27e20-image.png

        Pick time entries as you wish.
        "pkg_check.php" must be the name of the file you created above.

        Start by installing the pfSense cron package.

        No "help me" PM's please. Use the forum, the community will thank you.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright 2026 Rubicon Communications LLC (Netgate). All rights reserved.