Automatic periodic reboot howto?



  • Hello
    Does any one know how to make a script ro perform automatic periodic reboots?
    For instance I want to reboot my PFSENSE every day at 3 AM; or For instance I want to reboot my PFSENSE every week at saturday day at 3 AM.

    Dracunciliasis



  • Why do you want to do this?

    However, look at diagnostics>edit file and open "/etc/crontab" and schedule your reboot there if needed.



  • If you want to use wget remotely (btw: this was sent to the mailing list this week, slightly modified):

    wget -qO /tmp/config_backup.xml –user=admin --password=pfsense --no-check-certificate "https://192.168.1.1/exec_raw.php?cmd=shutdown -r now"



  • @hoba:

    Why do you want to do this?

    However, look at diagnostics>edit file and open "/etc/crontab" and schedule your reboot there if needed.

    I've run this command  "/sbin/reboot" on the Diagnostics: Execute command just to chekout if the line that would be added  to the "/etc/crontab" would do no arm to the system and the system just hanged.

    @sullrich:

    If you want to use wget remotely (btw: this was sent to the mailing list this week, slightly modified):

    wget -qO /tmp/config_backup.xml –user=admin --password=pfsense --no-check-certificate "https://192.168.1.1/exec_raw.php?cmd=shutdown -r now"

    wget ?!? what's the purpose of wget in getting it rebooted automatically?



  • @dracunciliasis:

    @hoba:

    Why do you want to do this?

    However, look at diagnostics>edit file and open "/etc/crontab" and schedule your reboot there if needed.

    I've run this command  "/sbin/reboot" on the Diagnostics: Execute command just to chekout if the line that would be added  to the "/etc/crontab" would do no arm to the system and the system just hanged.

    @sullrich:

    If you want to use wget remotely (btw: this was sent to the mailing list this week, slightly modified):

    wget -qO /tmp/config_backup.xml –user=admin --password=pfsense --no-check-certificate "https://192.168.1.1/exec_raw.php?cmd=shutdown -r now"

    wget ?!? what's the purpose of wget in getting it rebooted automatically?

    wget executes the "shutdown -r now" command via diagnostics>command for you. See it like a kind of "remote procedure call". Btw, this is also the command you should run in crontab.



  • @sullrich:

    If you want to use wget remotely (btw: this was sent to the mailing list this week, slightly modified):

    wget -qO /tmp/config_backup.xml –user=admin --password=pfsense --no-check-certificate "https://192.168.1.1/exec_raw.php?cmd=shutdown -r now"

    Sorry to bring this thread up again but when I run the command below from my windows machine I get…"/tmp/config_backup.xml: No such file or directory.

    I would like to remotely shutdown my pfsense machine from my windows machine.

    wget -qO /tmp/config_backup.xml --user=admin --password=pfsense --no-check-certificate "https://192.168.1.1/exec_raw.php?cmd=shutdown -r now"



  • /tmp/ is a unix directory.  you most likely want to substitute it for something like c:\mybackup\ etc



  • Thanks I created the config_backup.xml as an empty file and now it works.
    Many thanks.



  • Hint: Never ever edit /etc/crontab directly. It is getting regenerated during each reboot. So your changes may be lost after a reboot.

    Cheers
    Daniel S. Haischt



  • I created the config_backup.xml file locally on my windows machine and put it in the same folder as wget.
    Running this works…
    wget -qO config_backup.xml --user=admin --password=pfsense --no-check-certificate "https://192.168.0.2/exec_raw.php?cmd=shutdown -r now"

    Is that OK to do?



  • Yes!


Log in to reply