Wake on lan & cron



  • has anybody sucessfully setup a cron job on pfsense that wakes a pc up on the network?
    i have a nas box (freenas) which is just used for backups and is not on all the time. it supports wake on lan and i can wake it from within the pfsense gui.
    what i would like to do is set a cron job within pfsense (package cron is installed) to wake the nas box up.
    the nas box will then do a cron'd backup of internal & external resources using rsync/ssh. i've set this bit up already but was just looking for the final peice in the jigsaw with pfsense.
    i guess i'm really asking "does anybody know the command line script for wol?"

    louis



  • sorted….. a little bit of trail and error and googling.....

    wol -v -i <broadcast address=""><mac address="">the rest is straight forward now. is it safe to save sshkeys on pfsense to do automated logins to external webservers

    eg wake up my freenas box, 5 mins later rsync between webserver and freenas box and then shutdown freenas box when backup is complete?</mac></broadcast>



  • The command is:  /usr/local/bin/wol -i <interface broadcast="" address=""><mac id="" of="" machine="">So if the LAN interface subnet is: 192.168.1.0/24
    and the NAS MAC ID is: 12:34:56:78

    Then you just need to run:  /usr/local/bin/wol -i 192.168.1.255 12:34:56:78

    Edit:  You posted before I did.  The Verbose switch is not required for an automated task like this but you can leave it there for logging purposes.</mac></interface>



  • Wouldn't it be easier to setup a cron job on the Freenas unit instead?  Since you would run the WoL on a schedule, you could set the Cron job in pfSense to wake up the Freenas say, at 1:00am; have the FreeNAS cron job perform the automated rsync back up at 1:05am and shutdown when complete.  Then you won't need to ssh into the unit.



  • thanks for the quick reply. it's setup already from the freenas box so it would be easier yes.
    i was just wondering if there any any implications to storing keys on pfsense? i'm not going to do it as having them on the freenas box is an extra layer but it was just something i was toying with.


Log in to reply