Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

When does /etc/daily.local run?

When does a shell script in /etc/daily.local run? I thought it runs at 3:15 AM every day if the computer is on at that time. If it is off, it will run the next time the computer is running. But actually the script (and none of the other /etc/periodic/daily scripts) is never executed.

Can it be that the script only runs delayed if the computer is sleeping and not if it is completely shut down??

iMac, MacBook, Mac OS X (10.5.6)

Posted on Jan 29, 2009 5:24 PM

Reply
18 replies

Jan 29, 2009 5:52 PM in response to gvde

gvde wrote:
When does a shell script in /etc/daily.local run?


you mean scripts in /etc/periodic/daily, right? i have no /etc/daily.local on any of my computers. is this something you added yourself?
I thought it runs at 3:15 AM every day if the computer is on at that time. If it is off, it will run the next time the computer is running. But actually the script (and none of the other /etc/periodic/daily scripts) is never executed.

how do you know that? look in /var/log/daily.out (you can access it from Console). what does it say?
Can it be that the script only runs delayed if the computer is sleeping and not if it is completely shut down??

no, it should run the first chance it gets on computer power up.

Message was edited by: V.K.

Jan 29, 2009 7:30 PM in response to V.K.

I leave my computer on all week letting it sleep overnight, except for Saturday night and Sunday when I turn it off completely. I see in my daily.out files that it runs the daily script every day when I wake the computer up, but there is no daily.out entry for the Monday's when I power it up. For the nights when I have forced it to stay awake (doing a long job) it executes daily.out at 3:15 am.

Jan 29, 2009 7:33 PM in response to b99

there have been a lot of debate about it on this forum and I've seen a number of claims by people who shut down their computers overnight that daily scripts run the next morning. that's what i was basing my response on. I never shut down my mac and sleep it only so I can't confirm this personally.

Jan 29, 2009 7:52 PM in response to V.K.

you mean scripts in /etc/periodic/daily, right? i have no /etc/daily.local on any of my computers. is this something you added yourself?


/etc/daily.local is standard Apple. It is called from /etc/periodic/daily/500.daily.

I thought it runs at 3:15 AM every day if the computer is on at that time. If it is off, it will run the next time the computer is running. But actually the script (and none of the other /etc/periodic/daily scripts) is never executed.

how do you know that? look in /var/log/daily.out (you can access it from Console). what does it say?


daily.log does not say anything. It is dated January 2nd, 3:15. Nothing since then.

The script currently only appends the output of "date" to a file which is writable for all users. There is nothing in this file added.

Jan 29, 2009 8:03 PM in response to gvde

gvde wrote:
you mean scripts in /etc/periodic/daily, right? i have no /etc/daily.local on any of my computers. is this something you added yourself?


/etc/daily.local is standard Apple. It is called from /etc/periodic/daily/500.daily.

you are quite right. I looked inside /etc/periodic/daily/500.daily and /etc/daily.local should be executed if it exists when the daily script runs.
I thought it runs at 3:15 AM every day if the computer is on at that time. If it is off, it will run the next time the computer is running. But actually the script (and none of the other /etc/periodic/daily scripts) is never executed.

how do you know that? look in /var/log/daily.out (you can access it from Console). what does it say?


daily.log does not say anything. It is dated January 2nd, 3:15. Nothing since then.

The script currently only appends the output of "date" to a file which is writable for all users. There is nothing in this file added.

ok then. as I said in my other reply in this thread this subject has been oft debated on this forum and i've seen a number of people who shut down their computers overnight saying that their daily scripts still run. that's what i was basing my response on. I never shut down my macs myself. It could indeed be that daily script doesn't run if the computer is shut down overnight. I'm going to make /etc/daily.local file and shut down my mac tonight we'll see what happens.
In the meantime you can either sleep your mac instead of shutting it down or change the time the daily script should run to some time during the day while the computer is on.

Jan 29, 2009 9:15 PM in response to gvde

There is virtually no reason to run periodic daily if the computer is restarted every day. The most significant thing the daily scripts do (in Leopard) is delete temporary files (in /tmp) that have not been accessed in at least 3 days. But /tmp is cleared as part of the startup process, so there will never be anything to delete on a system that is restarted frequently. The periodic scripts are mostly for "long-lived" systems, i.e., systems that have been up continuously for weeks or months at a stretch.

Jan 29, 2009 10:56 PM in response to Jeffrey Jones2

The same problem seem to apply to weekly and monthly scripts as well.

There are 5 daily scripts.
There are 2 weekly scripts.
There are 2 monthly scripts.

The 5 daily scripts do a lot more then only clearing /tmp.

The computer is often longer on then off. I only turn it off at night.

I very much do not agree with you that there is "virtually no reason to run periodic daily", weekly, monthly. These are maintenance scripts which should run regularly. I guess I am not the only one who turns off the computer at night...

Jan 30, 2009 11:30 AM in response to gvde

Yes, there are 5 daily scripts. Here is what they do: (This list is complete only for Leopard.)

100.clean-logs Looks for crash logs in /Library/Logs/CrashReporter. Deletes any that have not been accessed for at least 60 days. This is obviously not an urgent task.

110.clean-tmps Delete temporary files in /tmp that have not been accessed for at least 3 days. As I said earlier, a system that is restarted frequently will never have any files affected by this.

130.clean-msgs Delete system messages. This is relevant only for multi-user Unix systems.

430.staus-rwho Writes a system status message (mainly system uptime) in the daily.out log. This is just reporting, not maintenance.

500.daily This does several things:

Delete rwho messages older than 7 days. This has to do with Unix networks, and is irrelevant for almost everyone.

Delete fax scratch files older than 7 days. This is only relevant if you use your Mac as a fax machine.

Finally, some accounting and system status information is written in the log.

That's it, unless you or your system administrator have defined some local tasks. Unless you are running a Unix cluster or regularly using your Mac as a fax machine -- and shutting the machine down every night, without exception -- there is nothing urgent in the daily scripts.

The weekly scripts update two databases, of interest only to Unix users. If you are not a Unix user there is never any reason to run weekly. The locate database is used by the locate command. If you are a regular user of locate, you should evaluate whether the index as built by weekly is complete enough for your purposes. The whatis database is an index of Unix man pages. It only needs to be rebuilt if you have installed new Unix documentation. In that case, the logical time to rebuild whatis is as part of the installation process, rather than waiting for the next weekly run. Again, if you are not a Unix user, you do not need to rebuild these databases at all.

The monthly scripts may do two things. One is to write some accounting information in the monthly.out log. I don't think the relevant accounting mechanism is used anymore in Leopard, so this appears to be obsolete. It never does anything on my system, in any case. The second thing monthly does is to archive and recycle fax logs. If you do not use your Mac as a fax machine, it is never necessary to run monthly.

Somewhere along the line someone applied the term "maintenance" to the periodic scripts, leading many to believe that they perform some crucial tasks. In fact, it is only minor housekeeping. And in Leopard, they really do run automatically if needed, and the housekeeping is more minor than ever.

Jan 30, 2009 11:48 AM in response to gvde

gvde wrote:
When does a shell script in /etc/daily.local run? I thought it runs at 3:15 AM every day if the computer is on at that time. If it is off, it will run the next time the computer is running. But actually the script (and none of the other /etc/periodic/daily scripts) is never executed.

You were misinformed. If the computer is turned off during the time the scripts should run, they will not run when the computer is turned on. Only if the computer is sleeping will the scripts run when it wakes up.
Can it be that the script only runs delayed if the computer is sleeping and not if it is completely shut down??

Yes, that is absolutely correct. You will find words to the contrary if you google, but then, google, like Wiki, is not truth.

You might consider adding the Maintidget widget and run them manually, as I do, if you really want them to run. They are relatively unnecessary, but I run them just the same although not on a regular basis. Just whenever the mood hits me 🙂

Another reference for this is here:
http://discussions.apple.com/thread.jspa?messageID=8387203&#8387203

Message was edited by: nerowolfe

Message was edited by: nerowolfe

Jan 30, 2009 1:32 PM in response to Jeffrey Jones2

thanks a lot for that info. it is quite helpful. I agree, none of this is urgent or necessary for most people.

still, if someone really wants to run those periodic tasks anyway and they shut down their computers overnight the easiest thing to do is to change the scheduled times for the periodic tasks to occur some time during the day. this can be done by editing the periodic tasks plists located in /System/Library/LaunchDaemons.

The easiest way to edit them is by using Lingon http://tuppis.com/lingon/ or Property List Editor.

Jan 30, 2009 4:16 PM in response to Jeffrey Jones2

It does not matter how big or urgent or important this "housekeeping" is. It is still maintenance. It was placed in scripts which should run regularly. This is what a user would expect. These tasks are not run if the computer is turned off. Most of these tasks are not run during shutdown or startup. Basically many of these tasks are never run if the user turns off the computer for the night. Last time my daily script run was only because I converted a couple of AVCHD movies through the night.

So your argument is pointless. My weekly script never ran in more then 2 years (assuming something similar was in Tiger, or otherwise since Leopard is out)! anacron is available for many years now. It should not be too difficult to have a mechanism to execute some scripts regularly and delayed if the computer is shut down at the scheduled time. It is pointless to argument the urgency or important of these tasks in response to a question regarding the execution of daily.local. Evidently I use some shell script in daily.local. Evidently, I am a "UNIX user" (not that MacOS is Unix anyway). Instead of arguing the urgency of the tasks in the scripts it would suffice to say that these scripts in fact run only if the computer was awake or sleeping during the scheduled time.

The daily.local is part of these scripts and at first sight seems to be a good place to place some shell scripts to do something like a daily backup. But finally nerowolfe confirmed that these scripts don't run if the computer has been shut down.

Jan 30, 2009 4:41 PM in response to V.K.

I cannot really change the schedule. It is for a computer which is turn on/off mostly randomly and often only for a short period of time, 2-3 times a week. There is no time at which I can reliable say the computer will be always running at that time.

I guess I will have to add the script to the shutdown or startup scripts. Does MacOS use launchd instead of /etc/rc* for that, too? Or what would be the place in MacOS to add a shell script during startup or shutdown.

When does /etc/daily.local run?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.