Run Terminal Command While Computer is Asleep?

Discussion in 'Mac Programming' started by MBP123, May 5, 2016.

  1. MBP123 macrumors regular

    May 26, 2006
    I have a Terminal command that will probably take ~24 hours to complete, but I am traveling the next few days and won't be able to leave the computer plugged in for 24 straight hours. If I close the laptop with Terminal still running, I'm assuming it will pause the command? Will it resume where it left off as soon as the computer wakes again?
  2. cerberusss macrumors 6502a


    Aug 25, 2013
    The Netherlands
    Yes, it will resume. If it does network calls, or anything time dependent, these will fail of course. If you're running a build, or some kind of calculation, it'll be fine.

    An alternative would be a virtual machine somewhere. I've had the same. I'd be traveling through Indonesia with very spotty Internet connection. But the app I was working on, was a 200+ MB monster.

    What I did, was rent an OS X virtual machine. I'd do development locally and push changes to my repository whenever there was a connection. To roll out a new build, I'd VNC to the server and do a new build there.
  3. chown33, May 5, 2016
    Last edited: May 7, 2016

    chown33 macrumors 604

    Aug 9, 2009
    If it's entirely command-line, and the commands exist for Linux, an Amazon EC2 instance would work. They're pretty cheap, and you only pay for them when they're active. That is, you only pay for it while it exists, rather than a fixed daily, weekly, or monthly fee.

    An EC2 instance has access to S3, so you can stored data there and it will survive through downs and ups of EC2 instances.

    SSH command-line access to an EC2 instance is pretty easy. It's just a single command in the Mac Terminal, and boom you have a remote shell. There are also Mac App Store apps for accessing AWS (both EC2 and S3 are services under that umbrella). Two examples:

    Search terms to find more:
    mac app store ec2
  4. sero macrumors member

    Aug 28, 2008
    If you have access to another Mac/Linux machine, screen is really handy. Basically ssh in, start screen, launch command... You can close the connection, log in later and resume the screen session, everything will be where you left it (still running, completed, whatever). You could just leave the laptop at home, there are plenty of terminal emulators you could use on your phone to connect to it and control it from the road.
  5. aaronvan Suspended


    Dec 21, 2011
    República Cascadia
    From who? Not AWS (although I wish they would.)
  6. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley

Share This Page