How To Schedule A Job To Disable Ports On The HPE/Aruba-OS Switch
Can I configure my switch to disable ports during non-business hours and enable them again before business hours?
The HPE/Aruba-OS switches have a "job" function that can be configured to run a command at a specific time.
This can be used to schedule configuration changes at a given time each day.
This can be useful if specific ports should go offline during during non-business hours and come back online before business hours begin again.
This can be used to take a printer offline, an AP offline, user ports, etc.
At the Config prompt in the CLI interface, the following command syntax can be used to configure this feature:
- job <name> at HH:MM <config-save> "command"
Note: The "config-save" option will save the current configuration after the command completes. This will allow that change to remain configured in case of an unexpected reboot or power event.
A job that is configured to run at a set time, with no date specified, will continue to run each day at that configured time.
To take port A2 offline every evening at 9:00 pm and bring it back online at 6:00 am every morning, the following can be configured:
- job portoffline at 21:00 config-save "int a2 disable"
- job portonline at 6:00 config-save "int a2 enable"
To delete these jobs, the following commands can be run:
- no job portoffline (removes the job from the queue/config)
- no job portonline (removes the job from the queue/config)
If you want to keep the jobs, but disable them, the following commands can be run:
- job portoffline disable (disables the job so it doesn't run, but keeps it in the queue/config)
- job portonline disable (disables the job so it doesn't run, but keeps it in the queue/config)
To enable these jobs again, the following commands can be run:
- job portoffline enable
- job portonline enable