Can I setup a program in OSX to only run at login on a specific day of the week?
April 29, 2006 2:35 PM   Subscribe

Can I setup a program in OSX to only run at login on a specific day of the week?

I want to backup my hard drive one time a week. I like iBackup, its simple and free. I can schedule it to do the backup, lets say, on Wednesday at noon. No problem. But to make sure that happens, I have to set it as a program that will run upon login. I wouldn't mind this so much but 1) I like to leave as much memory free as I can, and this take memory up the other 6 days a week, and 2) When open, iBackup sits in the dock.

I guess an alternative would be how to hide the dock icon full time. But i'd rather just have it run from startup on the day I specify.

Thanks
posted by Chuck Cheeze to Computers & Internet (12 answers total) 1 user marked this as a favorite
 
You're looking for crontab hints, then.

Cronnix is one GUI interface that's widely suggested.
posted by five fresh fish at 3:01 PM on April 29, 2006


Possibily easier than learning crontab or launchd: You could create a simple, runnable applescript that checks the day of the week, and if it is wednesday it launches iBackup. Put said applescript into the login items in your Account preferences, and vĂ³ila.
posted by patr1ck at 3:03 PM on April 29, 2006


I vote for Lingon.
posted by Yeomans at 4:09 PM on April 29, 2006


Cron can't be used for this because cron will try to run the task even when the user isn't logged in.

Worse, if the machine is off at the designated time, cron won't run it later to "catch up".

I agree with the idea of using an encapsulating script of some kind. If this was UNIX, my approach would be to use a script which checked the output of the "date" command to see if the string for a particular day of the week (e.g. "Wednesday") was present in it, and then invoke the appropriate task if it was.

It would have to be made a bit more smart than that, however, so that it only ran the first time you logged in on a particular Wednesday, rather than on every login.
posted by Steven C. Den Beste at 4:25 PM on April 29, 2006


Another vote for Lingon. Use the "Assistant" like so:
  1. Select Run job at startup, then Next.
  2. Type in a name for this job, something like computerName.ChuckCheeze.iBackup, then Next.
  3. Type in the full path to iBackup (this could be tricky -- you'll need to find the executable within iBackup.app) then Create.
  4. Now, edit the job you just created.
  5. Choose Miscellaneous and put 0 in for Weekday, then Save & Load.
That ought to do it.
posted by Mike C. at 6:14 PM on April 29, 2006


Oops, meant to write that what I outlined should, theoretically, run iBackup when you login on Sunday. Of course, you can choose to have it run on whatever schedule you want, regardless of login, by using the other parts of Lingon's Assistant. Have fun, and good luck.
posted by Mike C. at 6:16 PM on April 29, 2006


if [ `date +%w` -eq 4 ]; then # do stuff; fi

/* adjust for your shell and day and &c */

copying and pasting code may injure your data or person. you take all responsibility. all rights reserved. do not taunt happy fun ball.
posted by kcm at 7:01 PM on April 29, 2006


I think there's a far easier way to go about this: Schedule Automator Workflows via iCal (from MacOSHints).
posted by mikel at 8:18 PM on April 29, 2006


If you want to do this with an AppleScript, here's how:

property lastDate : ""

set currentDate to (current date)
set {dateString, dayOfWeek} to {short date string of currentDate, weekday of currentDate}
if dateString is not lastDate and dayOfWeek is Wednesday then
    set lastDate to dateString
    do shell script "open '/Applications/iBackup.app'"
end if

(This runs it on the first login on Wednesday... if you want it to run every time you log in on Wedensday, just take out the line that says "set lastDate to dateString")

Save it as an application and add it to your login items. There's a little utility called Drop Script Backgrounder (Google for it) that will cause the saved script applet from showing up in your dock.
posted by kindall at 9:33 PM on April 29, 2006


The "login items" idea is great... unless you're the sole user of the machine and never log out (because with OS X, you basically never have to exit the OS). It's usually a month between reboots on my iBook G4.

Though I'm re-reading the OP and noting that he is talking about doing it at login, so it probably works out okay for him.
posted by five fresh fish at 9:37 AM on April 30, 2006


WOW lots of great suggestions, thanks. I'll try some of them out and see what works for me. FYI I want the ability to run it ata convenient time of day, not just at login. Sorry if my question was misleading.
posted by Chuck Cheeze at 10:16 AM on April 30, 2006


uhm, unless I'm missing something...

do you mean "Backup", not "iBackup"? "Backup" is "free" with a .mac account and allows you to schedule the date and time without having to be a login item. you just have to manually quit it afterwards.
posted by saketini99 at 5:03 PM on May 2, 2006


« Older Caveats of doing a mass e-mail   |   Why do some people find the smell of gasoline... Newer »
This thread is closed to new comments.