Shutdown opnsense at "x" hours

Started by akenopnsense, August 23, 2018, 12:05:21 PM

Previous topic - Next topic
Dear Sir/Madam

  am using OPNsense 18.1.6-i386 wherein am not able to find setting for enabling me to shut down opnsense at specific time,i.e. after office hours automatically.

   do guide me, if this is even possible.

Regs
Ken

August 23, 2018, 02:36:44 PM #1 Last Edit: August 23, 2018, 08:06:25 PM by marjohn56
If you shut it down, how are you going to restart it?


You need to follow the instructions here to create a cron  job - that job will call the shutdown script you will also need to create. The will be a shell script to call the shutdown command.


http://kb.unixservertech.com/other/networking/opnsense/cron-jobs
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

Office hours ends at 5:00 PM daily and shutting down is manual everyday. restart would be next day at 9:00 AM. so there is no restart needed.

can you suggest the script that will go for shut down at x hours daily or point me to some eg.

August 24, 2018, 09:40:58 AM #3 Last Edit: August 24, 2018, 09:42:44 AM by marjohn56
There already is one, the system shutdown script =  "/usr/local/etc/rc.halt".
So all you need to do is create the "actions_shutdown.conf" file, which should look like this:



[shutdown]
command:/usr/local/etc/rc.halt
parameters:
type:script
message:cron event shutting down
description:Shutdown System



Save the file to "/usr/local/opnsense/service/conf/actions.d" folder.


Now go to the console and issue the following command
# service configd restart


Now you can create your cron event. Should look like this:





Obviously change the time to suit.  :)

OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

sorry for the late reply.. thanks a lot. it works and am really happy now