Schedule Auto Reboot Fortigate

DescriptionAll of the FortiOS firmware so far allow the user to program a daily restart (reboot) of the FortiGate, at a pre-defined hour.  This is a repeated reboot and it can be used for a one-time reboot at a predefined hour (with the mention that it needs to be removed afterwards).The alternate options become available gradually in form of an auto-script that can further fine-tune the reboot cycle, or add additional commands (starting with FortiOS 5.6).  More recently (starting with FortiOS 6.2), a more advanced way via Automation Stitch (FortiOS 6.0 has Automation Stitch, but can only be triggered by an event, and not Scheduled).


Scope


SolutionDaily restart.This option is configurable from the CLI as shown in the example below: 

# config system global

set daily-restart enable

set restart-time 05:06

end

 – Once the restart time is reached, the following message is displayed on the CLI console: 

FGT # The system will reboot due to scheduled daily restart. Current time is 05:06

– Syslog message relative to this event: 

2021-10-21 05:06:51 log_id=0104041990 type=event subtype=admin pri=information fwver=040000 vd=root msg=”Fortigate started”

– And the following entry will be logged under the GUI event logs: 

2021-10-21    05:06:51    information    admin    41990    Fortigate started

Automation stitch reboot. This option presents another level of integration with the operational level of the network. An action can be triggered based on specific predefined triggers. In this example, a periodic reboot not triggered by a specific event has been used. Note.Use short, simple names, and no spaces in the name field.  

The CLI commands created by this action: 

# config system automation-action

    edit “rebooot”

        set action-type cli-script

        set required enable

        set script “exec reboot”

        set accprofile “super_admin”

    end

# config system automation-trigger

edit “autoreboot”

        set trigger-type scheduled

        set trigger-frequency weekly

        set trigger-weekday monday

        set trigger-hour 20

        set trigger-minute 10

    next

end

# config system automation-stitch

edit “auto reboot”

        set trigger “autoreboot”

        set action “rebooot”

    next

end