cron_restart_port.php
As of FreeNAC v3.0 we have modified the cron_restart_port.php to make it more functional.
In previous versions of FreeNAC, cron_restart_port was a wrapper around the restart_port script. This has changed now in this new version. Even though we still provide a restart_port.php script, we now don't fork a syscall for this script. Instead, we use SNMP functions to achieve the same results from inside the same script, saving thus both time and resources.
In the event that you want to experiment with the restart_port.php script from the command line, you should run it as follows:
restart_port.php port switch
where port is the port name, and switch is the switch's name or ip address. This script only supports one switch port at the time. To act upon more than one switch port at the same time, you have the cron_restart_port.php script at your disposal.
What this script does, is to go through the list of ports in the FreeNAC database whose restart_now flag equals 1. Obviously to interact with this script you need to do it through the Windows GUI. From the windows GUI you can choose not only to restart the port(s), but also to program them as static and assign a vlan to them, or as dynamic or even shut down the ports.
Everytime this script is run, it generates a PID file, thus ensuring that only one instance of the script will run at all times.
To restart a port, you should tick the restart box in the Windows GUI
![]()
In syslog you should get the following messages:
Oct 31 10:35:02 vmps1 cron_restart_port.php[3592]: Port Fa0/1 successfully restarted on switch 192.168.1.1(swdemo)
To shutdown a port, you should tick the shutdown box in the Windows GUI
![]()
In syslog you should get the following messages:
Oct 31 10:38:01 vmps1 cron_restart_port.php[3655]: Port Fa0/1 on switch 192.168.1.1(swdemo) was successfully shutdown
To program a port as static, you should select 'static' from the drop down list and also the vlan you want to assign to this port. In this example, we are assigning the 'default' vlan.
![]()
In syslog you should get the following messages:
Oct 31 10:39:02 vmps1 cron_restart_port.php[3665]: Port Fa0/1 on switch 192.168.1.1 successfully set to static with vlan default
To program the port as dynamic, you should select 'dynamic' from the drop down list.
![]()
In syslog you should get the following messages:
Oct 31 10:41:01 vmps1 cron_restart_port.php[3725]: Port Fa0/1 on switch 192.168.1.1 successfully set to dynamic.
Bugs and comments, please discuss them in the forums.
- Printer-friendly version
- Login or register to post comments