Technical Tip: How to perform an FortiNAC reboot or restart NAC service using a custom script on a scheduler
| Description | This article describes how to run a script out of the scheduler to run FortiNAC reboot or restart NAC service based on a schedule. |
| Scope | FortiNAC. |
| Solution |
Create a script file 'Run-Reboot' under /home/cm/scripts:
execute enter-shell $ vi Run-Reboot #!/bin/sh # Check if environment file .yams exists # Go to the main directory (optional) # Display a message # Execute reboot command exit 0 List the file under the /home/cm/scripts directory: /home/cm/scripts$ ll Make the script executable:
List:
$ ll
Create the scheduler in the FortiNAC GUI:
Add a new Scheduler Activity:
On FortiNAC CLI, under /home/cm/scripts create a custom script file named 'RestartNAC': execute enter-shell $ vi RestartNAC
sudo systemctl restart nac // use ESC button :wq ---> use :wq to save the file Verify the file under the /home/cm/scripts directory: /home/cm/scripts$ ll RestartNAC To utilize the script on FortiNAC GUI 'Scheduler' make the script executable using the following command on FortiNAC CLI: $ chmod +x restartNAC /home/cm/scripts$ ll RestartNAC On FortiNAC GUI, System -> Scheduler -> Create New Scheduled Activity using Custom script and utilize the restartNAC script under command:
Scheduled Type can be defined as either a Repetitive, a Once, or a Fixed Day. Troubleshoot: To troubleshoot scheduler tasks activity, enable the following debug processes in FortiNAC:
execute enter-shell diagnose debug plugin enable SchedulerInterface diagnose tail -F output.master
Manually run the script from Scheduler View and verify the output.master log.
|



