Skip to main content
Hatibi
Staff & Editor
Staff & Editor
June 12, 2025

Technical Tip: Execute a database backup or any Scheduled task from CLI

  • June 12, 2025
  • 0 replies
  • 251 views
Description This article describes how to run a scheduled task manually from the CLI. This can be helpful in cases where a Database backup or any other task needs to be executed and there might be no GUI access.
Scope FortiNAC, FortiNAC-F.
Solution

Any scheduled task in FortiNAC can be executed manually from the CLI using the 'schedule' program.

It is used to display and manipulate scheduled tasks based on the task's Unique ID.

 

Options:


-id  Task ID used with -run, -pause, -enable, -delete and -detail
-run To run a task.
-pause To pause a task.
-enable To enable a task.
-delete To delete a task.
-detail To display detailed information about a task.
-all Dump task information.
-hidden Show system tasks normally hidden.

 

Example 1: To dump tasks:


Schedule -all

 

Example 2: To run a task:


Schedule -run -id 2

 

Example 3: To pause a task:


Schedule -pause -id 2

 

Example 4: To display detailed information:


Schedule -detail -id 2

 

Example 5: To show all tasks, including hidden:


Schedule -all -hidden

 

In the below example, there is a need to collect the latest database backup from the CLI.

Initially, it is required to list the scheduled tasks and their Unique IDs.

 

naclab1 # execute enter-shell
naclab1:~$ schedule -all
ID name previousScheduledTime scheduledTime pause hidden
________________________________ ________________________________ ________________________________ ________________________________ ________________________________ ________________________________
1 System Backup Mon May 26 01:10:21 CEST 2025 Mon Jun 16 01:10:02 CEST 2025 false false
2 Database Archive and Purge Mon May 26 01:01:21 CEST 2025 Mon Jun 16 01:01:02 CEST 2025 false false
3 Certificate Expiration Monitor Sat Jun 07 10:00:00 CEST 2025 Thu Jun 12 10:00:00 CEST 2025 false false
4 Database BackUp Wed Jun 11 00:01:53 CEST 2025 Fri Jun 13 00:01:02 CEST 2025 false false
5 Auto-Definition Synchronizer Sun May 25 01:01:00 CEST 2025 Sun Jun 15 01:01:00 CEST 2025 false false
6 Synchronize Users with Directory Fri Jun 06 12:47:14 CEST 2025 Thu Jun 12 12:47:14 CEST 2025 false false
7 Resync_Interfaces_for_firewall Sat May 24 17:48:19 CEST 2025 Fri Jun 13 17:48:19 CEST 2025 false false
272250320234496 License Expiring Monitor Fri Jun 06 12:00:00 CEST 2025 Thu Jun 12 12:00:00 CEST 2025 false false
287241905074176 test Thu Jun 12 11:40:36 CEST 2025 false false

 

It is of interest to note the task's name and the corresponding ID, which in this case is 4.

 

Run the database backup from the CLI:

 

naclab1:~$ schedule -run -id 4
Running Database BackUp
naclab1:~$

 

Validate the creation of the new entry backup file in the Database file storage directory:

 

naclab1:~$ ll /bsc/backups/database/
total 48936
1708 -rw-rw-r-- 1 nac cmdb 1745185 Mar 14 16:57 FortiNAC_DataBase_BackUp_2025_03_14_16_57_34_naclab1.gz
1712 -rw-rw-r-- 1 nac cmdb 1749086 Mar 17 16:08 FortiNAC_DataBase_BackUp_2025_03_17_16_08_11_naclab1.gz
1716 -rw-rw-r-- 1 nac cmdb 1753294 Mar 18 00:01 FortiNAC_DataBase_BackUp_2025_03_18_00_01_12_naclab1.gz

..

...

1856 -rw-r--r-- 1 root root 1897176 Jun 11 15:16 FortiNAC_DataBase_BackUp_2025_06_11_15_16_57_naclab1.gz
1856 -rw-r--r-- 1 root root 1898834 Jun 12 09:41 FortiNAC_DataBase_BackUp_2025_06_12_09_41_48_naclab1.gz

 

Related documents:

Backup and restore

Technical Tip: FortiNAC-F system restore procedure

Technical Tip: FortiNAC general troubleshooting guide