OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • Archive »
  • 18.1 Legacy Series »
  • Shutdown opnsense at "x" hours
« previous next »
  • Print
Pages: [1]

Author Topic: Shutdown opnsense at "x" hours  (Read 4477 times)

akenopnsense

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Shutdown opnsense at "x" hours
« on: August 23, 2018, 12:05:21 pm »
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
Logged

marjohn56

  • Hero Member
  • *****
  • Posts: 1676
  • Karma: 168
    • View Profile
Re: Shutdown opnsense at "x" hours
« Reply #1 on: August 23, 2018, 02:36:44 pm »
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
« Last Edit: August 23, 2018, 08:06:25 pm by marjohn56 »
Logged
OPNsense 21.7 - Qotom Q355G4 - ISP - Community Fibre 1Gbps.

Team Rebellion Member - If we've helped you remember to applaud

akenopnsense

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Re: Shutdown opnsense at "x" hours
« Reply #2 on: August 24, 2018, 08:49:00 am »
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.
Logged

marjohn56

  • Hero Member
  • *****
  • Posts: 1676
  • Karma: 168
    • View Profile
Re: Shutdown opnsense at "x" hours
« Reply #3 on: August 24, 2018, 09:40:58 am »
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:



Code: [Select]
[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.  :)

« Last Edit: August 24, 2018, 09:42:44 am by marjohn56 »
Logged
OPNsense 21.7 - Qotom Q355G4 - ISP - Community Fibre 1Gbps.

Team Rebellion Member - If we've helped you remember to applaud

akenopnsense

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Re: Shutdown opnsense at "x" hours
« Reply #4 on: September 06, 2018, 01:34:50 pm »
sorry for the late reply.. thanks a lot. it works and am really happy now
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • Archive »
  • 18.1 Legacy Series »
  • Shutdown opnsense at "x" hours
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2023 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2