More like 'expect' via ssh. 'cron' is only the scheduler.
But this type of "API" is clumsy. Please report back when you've got it working.
A simple expect script on unix or windows execute via cron job should work.
I think I'm almost there... but not quite.
My "expect" script is like this now:
#!/usr/bin/expect -f spawn ssh email@example.com.XXX.XXX expect "firstname.lastname@example.org.XXX.XXX's password: " send "PASSWORD\r" expect "FGTXXXXXX # " send "execute reboot\r" expect "This operation will reboot the system !" expect "Do you want to continue? (y/n)" send "y\r"
But the FGT is not rebooting... am I missing something?
This is the output:
root@linuxserver:# ./test.sh spawn ssh email@example.com.XXX.XXX firstname.lastname@example.org.XXX.XXX's password: FGTXXXXXX # execute reboot This operation will reboot the system ! Do you want to continue? (y/n)root@linuxserver:#
We use a default user for the reboot and feed a list that read in for the hosts. Works like magic, & have been using something similar for backups and manual updates. Just tweak it for whatever you want.
The same script can be adjust for non-fortigate firewalll ( Juniper, pfsense, Huawei, ASA,etc.....)
YMMV and enjoy ;)
edit toadd: ensure the user that the cron is running as can read/permission of the file ( I've been caught on that one many many many times )