Results 1 to 5 of 5

Thread: Cron job to remote machine when sleep mode.

  1. #1
    Join Date
    Aug 2013
    Beans
    8

    Cron job to remote machine when sleep mode.

    Hi guys,

    I have a question regarding cron jobs. I want to setup some jobs using rsync to a remote machine, these jobs will most likely run overnight. If my remote machine is in sleep mode at the time my unbuntu server is attempting to execute the rsync job at the time, what will happen to the job? Will it execute once the machine comes back up or will it just simply fails and attempt to execute on the next scheduled time?


    Thanks.

  2. #2
    Join Date
    May 2012
    Beans
    248
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Cron job to remote machine when sleep mode.

    I'd say the job will just fail until the remote machine is awake the next time the job is scheduled.

    This might help you out: https://help.ubuntu.com/community/WakeOnLan

    I've never tried it, be interesting if it works for you.

  3. #3
    Join Date
    Jul 2013
    Location
    Wisconsin
    Beans
    2,409

    Re: Cron job to remote machine when sleep mode.

    Quote Originally Posted by charles6 View Post
    If my remote machine is in sleep mode at the time my unbuntu server is attempting to execute the rsync job at the time, what will happen to the job? Will it execute once the machine comes back up or will it just simply fails and attempt to execute on the next scheduled time?
    The job will simply fail, and attempt to execute at the next scheduled time.

    scbingham is right: Use a magic packet to wake the remote machine, wait a few seconds for the remote machine to come up, do a test connection to ensure the remote machine is ready, then do the rsync.

    Some older hardware does not support Wake On Lan (WOL), and WOL is designed to work on a LAN (not the internet or across a router). There are workarounds to the latter.

  4. #4
    Join Date
    Aug 2013
    Beans
    8

    Re: Cron job to remote machine when sleep mode.

    Thanks guys, i'll have a look. I figured that it wouldn't execute when coming back up.

  5. #5
    Join Date
    Sep 2006
    Beans
    8,166
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Cron job to remote machine when sleep mode.

    If you need a one-off action, then you could run at which should execute next time the machine is up. If you want cron-like job control but on a machine that may not be active all the time, then you may want anacron, but it is limited to jobs run once a day or less frequently.
    The Truth Shall Make Ye Fret.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •