Schedule Shutdown



  • Hi everyone, how can i schedule pfsense 1.2.2 to shutdown at a current time? I know i have to moify something in crontab but not sure on how to do it the right way.  Can someone show me or give me the direction?  Thanks guys.



  • If it's a one off event, try the at command.



  • Well, i'm thinking about shutting down my pfsense everynight at 11:45.  Is that possible?



  • Yes.  It looks like cron is running on 1.2 so you could put in a cron job to run "halt -p".

    Two things though:

    1. Make sure your host powers off, otherwise you'll still be using power, but doing nothing.

    2. Most hardware fails at power on.  You'll potentially be reducing the lifespan of your system considerably.



  • @Cry:

    Yes.  It looks like cron is running on 1.2 so you could put in a cron job to run "halt -p".

    Two things though:

    1. Make sure your host powers off, otherwise you'll still be using power, but doing nothing.

    2. Most hardware fails at power on.  You'll potentially be reducing the lifespan of your system considerably.

    So is it better to leave my system on 24/7 as i'm doing now? I was just thinking of saving energy that's all.  Thanks.



  • "It depends".

    You need to look at your overall cost and convenience.  How much does it cost you to run it?  How long will it take to pay back the cost of a replacement hard disk?  Would it be more cost effective to replace it with a lower power system?



  • This is for Clarkconnect but i was wondering if it will work on pfsense or do i have to modify it a little?  Please let me know.  Thanks.

    Automatic system shutdown
    To set you system to shutdown automatically you can create a 'cronjob' to closed down the system. (My Via ITX motherboard supports auto power-on through the BIOS, so I can set it to power up first thing in the morning).
    
    Note:- I don't use this anymore, I leave the server powered up 24 hours a day, the power usage is negligible, its silent when idle and it auto-updates the system in the early hours of the morning.
    
    Login with PuTTY and enter:
    
    crontab -e
    
    You will be presented with the vi editor (which isn't very friendly)...
    
    Press the 'a' key to enter the text mode
    
    Enter the following line:
    
    45 22 * * * /sbin/shutdown -h now
    
    Return to the command line by pressing 'Esc' key
    
    Save the file by entering:
    
    :w
    
    Exit the editor by entering:
    
    :q
    
    To check the file enter:
    
    crontab -l
    
    The above example shuts the system down at 22:45 (10:45pm), adjust the values to suit your requirements
    
    

    I found this at: http://www.ulverston.myzen.co.uk/mini-itx/pages/tuning.htm#Automatic_system_shutdown



  • As I said, use "halt -p".  pfSense is based on FreeBSD, ClarkConnect is based on Linux.  There are some significant differences ;)

    Otherwise, yes.  Just check timezones (type "date" at the command line) to ensure you shut it down when you expect.



  • I was wondering what to use on midnight time.

    A. 00
    B. 0
    C. 24

    Kinda confusing.



  • There is no 24:00 ;)

    Use either 00 or 0, either will work.  I strongly recommend you make use of the man pages (the FreeBSD man pages are available online).



  • Yeah, i've looked at the page but i believe i didn't find the time format.  I've tested using for example 45 17 and it work but when i use 45 0 it didn't turn off my pc, so i think i might have to use 00 double digit.



  • If you specify it as:

    45 0 * * * /sbin/halt -p
    

    Then it should shut down at quarter to one in the morning.  That format works on a standard FreeBSD host.


Locked