FortiNAC-F
FortiNAC-F is a zero-trust network access solution that provides users with enhanced visibility into the Internet of Things (IoT) devices on their enterprise networks. For legacy FortiNAC articles prior to FortiNAC-F 7.2, see FortiNAC.
ndumaj
Staff
Staff
Article Id 416944
Description This article describes how to run a script out of the Scheduler to run FortiNAC Reboot based on a schedule.
Scope FortiNAC.
Solution

Create a script file under /home/cm/scripts:

 

execute enter-shell
$ cd /home/cm/scripts/

$ vi Run-Reboot

#!/bin/sh
# -------------------------------------------------------
# Script Name : Run-Reboot
# Purpose : Executes a safe system reboot with sudo
# Location : /home/cm/scripts
# -------------------------------------------------------

# Check if environment file .yams exists
if [ -e /bsc/campusMgr/bin/.yams ]; then
. /bsc/campusMgr/bin/.yams
else
. /root/.profile
fi

# Go to the main directory (optional)
cd /bsc/campusMgr/bin

# Display a message
echo "Executing system reboot with sudo..."

# Execute reboot command
sudo /sbin/reboot

exit 0

List the file under the /home/cm/scripts directory:

/home/cm/scripts$ ll
total 32
20 -rwxrwxr-x 1 nac cmdb 15972 May 14 18:20 ServiceNow.example*
8 -rwxrwxr-x 1 nac cmdb 1244 May 14 18:20 RunSharedReports*
4 -rw-r--r-- 1 admin admin 563 Oct 27 16:36 Run-Reboot

Make the script executable:


$ chmod +x Run-Reboot

 

List:

 

$ ll
total 32
20 -rwxrwxr-x 1 nac cmdb 15972 May 14 18:20 ServiceNow.example*
8 -rwxrwxr-x 1 nac cmdb 1244 May 14 18:20 RunSharedReports*
4 -rwxrwxr-x 1 nac cmdb 563 Oct 27 16:36 Run-Reboot*

 

Create the scheduler in the FortiNAC GUI:


Scheduler 1.png


Based on business requirements, the Scheduled Type can be defined as either a Repetitive Task or a Fixed Day Task:


Scheduler 2.png