image
image

|


Go Back   macosx.com > Mac Help Forums > Mac OS X System & Mac Software

Reply
 
Thread Tools
  #1  
Old February 24th, 2006, 09:29 PM
Registered User
 
Join Date: Feb 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
talin is on a distinguished road
Question how do i change the time maintenance scripts run?

i want to change what time the daily/weekly/monthly maintenance scripts run. basically, i want them to run when my computer is more likely to be awake. is this possible?

i have onyx and have been manually running the maintenance scripts, but if possible, i would prefer not to have to mess around with onyx every day.

any help would be much appreciated!
_______________
12' powerbook G4
os x v10.4.5
Reply With Quote
  #2  
Old February 24th, 2006, 10:18 PM
jbarley's Avatar
One more, for the road!
 
Join Date: Jul 2005
Location: An Island called Vancouver
Posts: 363
Thanks: 0
Thanked 2 Times in 2 Posts
jbarley will become famous soon enough
Download and run a file called "Anacron". available here
http://members.cox.net/18james/anacron-tiger.html

this will make sure the scripts are run when your computer is up and available.

jb.
__________________
ROFL: (Rolling on the floor laughing.) Typically used by people who are too lazy to press the rest of the keys on their keyboard needed to communicate in English.
Reply With Quote
  #3  
Old February 25th, 2006, 12:48 AM
Registered User
 
Join Date: Feb 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
talin is on a distinguished road
thanks for the very fast response! i have another question tho

downloaded anacron then in the log file i got error message so i did what the directions said to do:
__________________________________
Messages reading "cp: error processing extended attributes: Operation not permitted" are from an error in Apple's periodic script. To get rid of the messages, carefully edit /usr/sbin/periodic to substitute > $tmp_output in place of cp /dev/null $tmp_output

__________________________________

the problem is, it won't let me save. gives the message: Couldn’t save document as “periodic” in folder “sbin”.

hmmm...what should i do now?
Reply With Quote
  #4  
Old February 25th, 2006, 05:54 AM
Registered User
 
Join Date: May 2005
Posts: 1,339
Thanks: 0
Thanked 1 Time in 1 Post
barhar is on a distinguished road
Or, you can ...

01. Set up a 'root' account.
02. Log in as 'root'. If you do not have 'fast user switching' enabled - you will have to 'log out' of the existing account.
03. Seiect 'Finder's 'Go, Go to Folder...' menu item ('Command <shift> G'), and in the 'Go to Folder' drop down sheet or separate 'Go to Folder' window, that appears, enter ...

/private/etc/

... and click on the 'Go' button.

If a file' crontab' exists ...
04. Drag 'crontab' onto 'TextEdit's 'Dock' based icon.
05. Add text such as ...

# Run daily/weekly/monthly jobs.
01 3 * * * root periodic daily
02 3 * * * root periodic monthly
03 3 * * * root periodic weekly

... and select 'TextEdit's 'File, Save' menu item.

If a file 'crontab' does not exist ...
04. Open (run, launch) 'TextEdit', and select its 'Format, Make Plain Text' menu item.
05. Add text such as ...

# /etc/crontab
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
# Run daily/weekly/monthly jobs.
01 3 * * * root periodic daily
02 3 * * * root periodic monthly
03 3 * * * root periodic weekly

... and select 'TextEdit's 'File, Save' menu item.

Note: as per '01 3 * * * root periodic daily' you enter the text as such ...

01<tab>3<tab>*<tab>*<tab>*<tab>root<tab>periodic daily

This also applies for '02 3 * * * root periodic monthly' and '03 3 * * * root periodic weekly'.
Also, I have 'periodic daily' executed at 3.01 (AM), 'periodic monthly' executed at 3.02 (AM), and 'periodic weekly' executed at 3.03 (AM). Change the values to what times you want the 'periodic's to execute.

If a file' crontab' exists ...
06. Save the changes - 'File, Save' menu item.

If a file 'crontab' does not exist ...
06. Save the changes - 'File, Save' menu item, and enter 'crontab' as the file's name, making sure you save the file the 'Desktop', and then dragging the 'Desktop' based 'crontab' file onto the opened '/private/etc/' folder's window.

07. Quit 'TextEdit'.
08. Log out as 'root' via the 'Apple, Log out System Administrator' menu item.
09. Log in to an existing account, to again use the Macintosh.

---

Now, let the Mac do what it is supposed to do - all without the need of any additional applications, error messages, file changes, etc.

[
Added 25 Feb. 2006, at 14.25.

The above instructions work, as is, without any additional steps needed, for 'Panther' (MacOS X 10.3.x); and, possibly 'Jaguar' (MacOS X 10.2.x).

---

For the above to work with 'Tiger' (MacOS X 10.4.x), and not to duplicate the 'periodic' executions - once by 'crontab' and once by 'Tiger's 'launchd' daemon / agent manager ...

... while logged in as 'root', go to '/Library/' and create a 'LaunchDaemons_disabled' folder. Then drag the three (3) files: 'com.apple.periodic-weekly.plist', 'com.apple.periodic-monthly.plist', and 'com.apple.periodic-daily.plist' from the '/Library/LaunchDaemons/' folder onto the '/Library/LaunchDaemons_disabled/' folder.

Or, if you prefer to use 'Tiger's 'launchd' services, instead of 'crontab' to manage your 'periodic's; but, at times (hours, minutes, which day, how often, etc) you want (other than what is currently entered), then ignore the above steps 03. through 09.; and instead, do the following.

03. Open the '/Library/LaunchDaemons/' folder.
04. Select and drag the three (3) files: 'com.apple.periodic-weekly.plist', 'com.apple.periodic-monthly.plist', and 'com.apple.periodic-daily.plist' onto 'TextEdit's 'Dock' based icon.
05. In 'com.apple.periodic-daily.plist's opened window scroll down to ...

<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>3</integer>
<key>Minute</key>
<integer>15</integer>
</dict>

... and edit the <interger> values. The first value being - the Hour, and the second value - the Minute.

As in my earlier example, this piece of code would be edited as ...

<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>3</integer>
<key>Minute</key>
<integer>1</integer>
</dict>

07. Save any changes.
08. In 'com.apple.periodic-weekly.plist's opened window scroll down to ...

<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>3</integer>
<key>Minute</key>
<integer>15</integer>
<key>Weekday</key>
<integer>6</integer>
</dict>

As in my earlier example, this piece of code would be edited as ...

<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>3</integer>
<key>Minute</key>
<integer>3</integer>
</dict>

... and edit the <interger> values. The first value being - the Hour, the second value - the Minute, and the third value - the Day in the week.
09. Save any changes.
10. In 'com.apple.periodic-monthly.plist's opened window scroll down to ...

<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>5</integer>
<key>Minute</key>
<integer>30</integer>
<key>Day</key>
<integer>1</integer>
</dict>

As in my earlier example, this piece of code would be edited as ...

<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>3</integer>
<key>Minute</key>
<integer>2</integer>
</dict>

... and edit the <interger> values. The first value being - the Hour, the second value - the Minute, and the third value - the day of the month.
11. Save any changes.
12. Quit 'TextEdit'.
13. Log out as 'root' via the 'Apple, Log out System Administrator' menu item.
14. Log in to an existing account, to again use the Macintosh.
]

Last edited by barhar; February 25th, 2006 at 01:25 PM.
Reply With Quote
  #5  
Old February 25th, 2006, 10:08 AM
ElDiabloConCaca's Avatar
U.S.D.A. Prime
 
Join Date: Aug 2001
Location: San Antonio, Texas
Posts: 9,735
Thanks: 2
Thanked 38 Times in 36 Posts
ElDiabloConCaca will become famous soon enough
Quote:
Originally Posted by talin
i want to change what time the daily/weekly/monthly maintenance scripts run. basically, i want them to run when my computer is more likely to be awake. is this possible?
If your computer is not awake when the daily/weekly/monthly cron scripts are supposed to run, then they will not run at that precise time (obviously). However, there is no need to force them to run, as they'll simply run when your computer does awaken.

If you check your Console application, you can see that these scripts run when they're supposed to automatically, without you having to run them manually. For example, my computer sleeps all night, so the scripts don't get run at 3am (or whenever they're set to run). Checking Console, under /var/logs, under "daily.out" (and likewise, "weekly.out" and "monthly.out"),I can see that the "daily" script ran at 9:33am this morning -- precisely the time I woke my computer up this morning. Looking backward in the log, I can see that the daily script ran every day at some point soon after I awoke the computer that day.

There is no need to run these scripts manually, because then you'd be running them twice: once automatically when the system awakes, then again when you force it to run.
__________________
Power Macintosh G4/500MHz "Yikes!" 10.4.11 Server • 1024MB • 3 x 120GB + 320GB • DVR-111D • 2 x Radeon 7000 PCI • 2 x 17" CRT
MacBook 2.0GHz Core 2 Duo - White 10.5.4 • 2048MB • 80GB • CD-RW/DVD-ROM
iPod Photo 60GB • iPod nano 1GB • AT&T DSL 6Mb/768k
http://www.jeffhoppe.com
Reply With Quote
  #6  
Old February 25th, 2006, 10:10 AM
jbarley's Avatar
One more, for the road!
 
Join Date: Jul 2005
Location: An Island called Vancouver
Posts: 363
Thanks: 0
Thanked 2 Times in 2 Posts
jbarley will become famous soon enough
Quote:
Originally Posted by talin
the problem is, it won't let me save. gives the message: Couldn’t save document as “periodic” in folder “sbin”.

hmmm...what should i do now?
My method was to edit the file as "root" in Terminal using sudo.

open Terminal
"sudo pico /usr/sbin/periodic" without the quotes
find and edit the text
ctrl+O
enter
ctrl+X

jb
__________________
ROFL: (Rolling on the floor laughing.) Typically used by people who are too lazy to press the rest of the keys on their keyboard needed to communicate in English.
Reply With Quote
  #7  
Old February 25th, 2006, 10:26 AM
jbarley's Avatar
One more, for the road!
 
Join Date: Jul 2005
Location: An Island called Vancouver
Posts: 363
Thanks: 0
Thanked 2 Times in 2 Posts
jbarley will become famous soon enough
Also, if one is curious, you can determine "exactly when your maintenance scripts were last run...

You can execute a Terminal command to quickly check the date and time stamps of the log files associated with each maintenance script. This indicates when the scripts' own logs were last updated, and hence when the scripts were last executed by the following...

Launch Terminal, in the Macintosh HD > Applications > Utilities folder.
At the Terminal prompt, type the following, exactly as written:
ls -al /var/log/*.out
Press Return.
You will see output similar to the following:

-rw-r--r-- 1 root wheel 467984 8 May 10:40 /var/log/daily.out
-rw-r--r-- 1 root wheel 1258 8 May 10:43 /var/log/monthly.out
-rw-r--r-- 1 root wheel 198378 8 May 10:43 /var/log/weekly.out
In this example, the scripts last ran on 8 May of the current year, between 10:40 and 10:43 local time. The date and time stamps in the example are the result of running the scripts manually using Terminal. If the scripts were run automatically on their default schedule, their date stamps would vary and their time stamps would indicate executions between 03:15 and 05:30 hours.

jb
__________________
ROFL: (Rolling on the floor laughing.) Typically used by people who are too lazy to press the rest of the keys on their keyboard needed to communicate in English.
Reply With Quote
  #8  
Old February 25th, 2006, 10:37 AM
ElDiabloConCaca's Avatar
U.S.D.A. Prime
 
Join Date: Aug 2001
Location: San Antonio, Texas
Posts: 9,735
Thanks: 2
Thanked 38 Times in 36 Posts
ElDiabloConCaca will become famous soon enough
Quote:
Originally Posted by jbarley
If the scripts were run automatically on their default schedule, their date stamps would vary and their time stamps would indicate executions between 03:15 and 05:30 hours.
The times of execution could be any time, depending on when the computer was first awakened after the script was supposed to run.

Here's mine from today:

-rw-r--r-- 1 root wheel 394469 Feb 25 09:34 /var/log/daily.out
-rw-r--r-- 1 root wheel 1579 Feb 1 12:52 /var/log/monthly.out
-rw-r--r-- 1 root wheel 9415 Feb 25 09:41 /var/log/weekly.out

You can see the times were around 9:30 this morning (right around the time I awoke the computer), and those scripts were run automatically without the need for me to force them to run with 3rd-party software or via a command-line command.

I'm stickin' to my guns and saying that 3rd-party software to run the daily/weekly/monthly cron scripts is useless, since they get run automatically the first chance the system has to run them. Running them twice (once automatically by the system, once again by the user forcing the running of them) is not beneficial at all. Running them manually is also pointless.

If the scripts are not running by themselves without user interaction, then that would indicate a deeper problem. In this case, using 3rd-party software or running the scripts manually is simply a band-aid, and a better course of action would be to hunt down the problem that is preventing them from running automatically.
__________________
Power Macintosh G4/500MHz "Yikes!" 10.4.11 Server • 1024MB • 3 x 120GB + 320GB • DVR-111D • 2 x Radeon 7000 PCI • 2 x 17" CRT
MacBook 2.0GHz Core 2 Duo - White 10.5.4 • 2048MB • 80GB • CD-RW/DVD-ROM
iPod Photo 60GB • iPod nano 1GB • AT&T DSL 6Mb/768k
http://www.jeffhoppe.com
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Time For Some Change... ScottW Site Discussion 44 May 12th, 2005 01:16 AM
can't change date & time alexandr Mac OS X System & Mac Software 4 March 16th, 2005 09:06 AM
.Mac maintenance banky Apple News, Rumors & Discussion 2 January 18th, 2005 06:54 AM
maintenance jonas79 Mac OS X System & Mac Software 3 February 12th, 2003 01:08 PM
Time to change... hELLO wORLD Site Discussion 3 March 9th, 2001 02:17 PM


All times are GMT -5. The time now is 06:13 AM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.