cron and laptop sleeping

Jump to First Reply
Posted:
in macOS edited January 2014
If I have my laptop asleep when the time for a cron task to run comes, will it run when wake my laptop? Is there anything that I can do about this?

Comments

  • Reply 1 of 15
    scottscott Posts: 7,431member
    Well ... you know ... test it out and tell us what happens.
     0Likes 0Dislikes 0Informatives
  • Reply 2 of 15
    kecksykecksy Posts: 1,002member
    You could just use a program like Cocktail to run cron when your computer's awake. Then your computer doesn't need to be awake a 3:00AM.
     0Likes 0Dislikes 0Informatives
  • Reply 3 of 15
    chuckerchucker Posts: 5,089member
    Quote:

    Originally posted by Kecksy

    You could just use a program like Cocktail to run cron when your computer's awake. Then your computer doesn't need to be awake a 3:00AM.



    Urr. The point of cron is to run at specified times\
     0Likes 0Dislikes 0Informatives
  • Reply 4 of 15
    defiantdefiant Posts: 4,876member
    Quote:

    Originally posted by Chucker

    Urr. The point of cron is to run at specified times\



    which would be the time when your computer awakes



     0Likes 0Dislikes 0Informatives
  • Reply 5 of 15
    Quote:

    Originally posted by pyr3

    If I have my laptop asleep when the time for a cron task to run comes, will it run when wake my laptop? Is there anything that I can do about this?



    No, it won't (and this is an annoying pain to me, as I have daily backups scheduled to run at midnight). I've started working on a cron replacement (GUI front end, etc.), but since I don't have much time and a lot of projects, it's going VERY slowly.



    John
     0Likes 0Dislikes 0Informatives
  • Reply 6 of 15
    xoolxool Posts: 2,460member
    Quote:

    Originally posted by John Whitney

    No, it won't (and this is an annoying pain to me, as I have daily backups scheduled to run at midnight). I've started working on a cron replacement (GUI front end, etc.), but since I don't have much time and a lot of projects, it's going VERY slowly.



    John




    Don't remember any of there names, but I know that a number of cocoa-based cron front ends have already been made by various shareware developers out there. A quick search on versiontracker will likely pull up a number of them.



    In fact a quick search of my HD found "CronniX". Haven't really used it recently (if ever), but it allows you to view, run, and modify the crontabs for the system and users.
     0Likes 0Dislikes 0Informatives
  • Reply 7 of 15
    Quote:

    Originally posted by Xool

    Don't remember any of there names, but I know that a number of cocoa-based cron front ends have already been made by various shareware developers out there. A quick search on versiontracker will likely pull up a number of them.



    In fact a quick search of my HD found "CronniX". Haven't really used it recently (if ever), but it allows you to view, run, and modify the crontabs for the system and users.




    I didn't mean just a front end. I meant a nice front end to a cron-replacement. I had envisioned it general interface being something along the lines of setting a recurring calendar appointment. However, my main objective is to have schedulable events that, if the computer is off or sleeping at the time of the events, runs the events at the first opportunity thereafter. This would come first, the front-end later.
     0Likes 0Dislikes 0Informatives
  • Reply 8 of 15
    I just changed my Energy Saver settings so that the laptop does not sleep when plugged in (the screen does, but not the cpu). That way I just plug in overnight and it does its thing.



    If you prefer to sleep the laptop overnight, MacJanitor is a nice little utility to run the cron tasks at odd times. You can run the daily, weekly, or monthly tasks....or all three at once.
     0Likes 0Dislikes 0Informatives
  • Reply 9 of 15
    serranoserrano Posts: 1,806member
    Quote:

    Originally posted by VanDeWaals

    I just changed my Energy Saver settings so that the laptop does not sleep when plugged in (the screen does, but not the cpu). That way I just plug in overnight and it does its thing.



    If you prefer to sleep the laptop overnight, MacJanitor is a nice little utility to run the cron tasks at odd times. You can run the daily, weekly, or monthly tasks....or all three at once.




    Ok, this is for you, and that poster above.



    Cron IS NOT the 'janitor' scripts that run at 3am. Cron is an app that will run scripts at specified times, Cron runs the 'janitor' scripts at 3 am, but it is not in itself those scripts. It can run scripts that do anything. The thread starter has written his own scripts that he would like to run at specified times using Cron, but he needs to know if cron will wake his ibook and run them, or run them when his ibook wakes up. The answer to both is no.
     0Likes 0Dislikes 0Informatives
  • Reply 10 of 15
    kickahakickaha Posts: 8,760member
    I know this is overkill, but iCal can trigger Applescripts at certain times as an alarm... doesn't iCal give you alarms that went by when it was asleep upon waking? If so, this could be the ticket. GUI front end, no less.
     0Likes 0Dislikes 0Informatives
  • Reply 11 of 15
    Quote:

    Originally posted by Kickaha

    I know this is overkill, but iCal can trigger Applescripts at certain times as an alarm... doesn't iCal give you alarms that went by when it was asleep upon waking? If so, this could be the ticket. GUI front end, no less.



    iCal doesn't run as a daemon, though, does it? As in, it won't generate any of these "alarms" unless it is explicitly running (and you are logged in)? It's only halfway to what I want, but still and interesting suggestion.
     0Likes 0Dislikes 0Informatives
  • Reply 12 of 15
    Quote:

    Originally posted by serrano

    Ok, this is for you, and that poster above.



    Cron IS NOT the 'janitor' scripts that run at 3am. Cron is an app that will run scripts at specified times, Cron runs the 'janitor' scripts at 3 am, but it is not in itself those scripts. It can run scripts that do anything. The thread starter has written his own scripts that he would like to run at specified times using Cron, but he needs to know if cron will wake his ibook and run them, or run them when his ibook wakes up. The answer to both is no.




    Hmmm...I knew that, but I obviously misunderstood the question. I stand corrected .
     0Likes 0Dislikes 0Informatives
  • Reply 13 of 15
    rraburrabu Posts: 264member
    iCal suffers the same problem. If your computer is asleep when some event notification should come up, you don't get it when the computer is woken. Similarly, if you aren't logged in and some event notifications pass, you don't get them when you log in. It would be extremely useful if you could set if a reminder should always come up or not. (Sometimes, once an event is passed you don't care to see the reminder later when you log in.) Even better would be to have expiry dates for the reminders so that if it is longer than X passed the original time the notification was supposed to come up, you don't get it. Otherwise, you get the notification which should also let you know how long overdue it was.



    The good thing I found with iCal is that you don't need to have the program running for notifications to pop up. There must be some sort of daemon (or they are using cron behind the scenes, I haven't checked) running to pop up notifications.
     0Likes 0Dislikes 0Informatives
  • Reply 14 of 15
    serranoserrano Posts: 1,806member
    Quote:

    Originally posted by VanDeWaals

    Hmmm...I knew that, but I obviously misunderstood the question. I stand corrected .



     0Likes 0Dislikes 0Informatives
  • Reply 15 of 15
    pyr3pyr3 Posts: 946member
    All someone needs to do is run a little program that detects when the laptop went to sleep and then when it wakes up. It then calculates what scripts needed to run but couldn't during that time. If any scripts didn't run you get some sort of a pop-up that lists all the scripts that didn't run and asks you if you would like to run the scripts now. Possibly have some sort of features where certain scripts can be individually specified to auto-run when the laptop wakes and and some scripts to not even bother being in the list of scripts. The list of scripts can possibly have checkboxes that are all auto-matically checked so that you can uncheck things you don't want to run. This sounds like a really good idea. What do you all think?
     0Likes 0Dislikes 0Informatives
Sign In or Register to comment.