• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Opening and closing applications periodically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Opening and closing applications periodically


  • Subject: Opening and closing applications periodically
  • From: Kristofer Widholm <email@hidden>
  • Date: Fri, 18 Jul 2003 13:00:30 -0400

At 19:38 -0700 2003.07.17, Erik Gilchrist wrote:

I just signed up am on DIGEST. Looked for an archive...

Anyhow, looking to launch an application in /Applications and then
every 2-4 hours quit and then relaunch it. It is a client that allows
me to use the NO-IP.com service and will update the NO-IP servers. It
is a beta (nothing but stable releases for OS X) and it works but tends
to just get confused at times.

Oh dear, I think I'll get shot for this, but I think there's an appropriate tool for every job, and in this case, the way to go is a combination of the cron utility and a brief shell script.

Cron is built into Mac OS X and allows you to schedule tasks to be run. It, like most things UNIX-y (not a trademark), is a little convoluted, but very flexible. If you're not familiar with cron, download the freeware cron editing utility Cronnix. It's pretty good.

Basically, cron will execute tasks on a minute by minute, or hourly, or daily, weekly, monthly basis. I use it run several maintenance tasks (it also changes my e-mail sig every four hours).

Just write an AppleScript that will launch your application. Save it as a run only application and tuck it away. Write another that closes your application nicely.

Now, just give cron the following parameters:
30 0,4,8,12,16,20 * * * /Path/to/your/Applescript/CloseApplication
35 0,4,8,12,16,20 * * * /Path/to/your/Applescript/OpenApplication

What this tells cron is this:
line 1: On the 30 minute of hours 0,4,8,12,16,20 of every day of every week of every month do ...
line 2: On the 35th minute of hours 0,4,8,.....

It will run your close script at the half hour mark, wait five minutes (give it time to close and cleanup and whatever), and then, open your program.

With the cronnix configuration utility, cron is really easy to configure. You owe it to yourself if you're doing scheduled tasks to look into it.

K

ps. You can also open and close your application with a simple command line argument to cron, but then I'd probably get kicked off this list forever.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
  • Prev by Date: getting bounds of terminal window
  • Next by Date: Re: do shell script getting NSReceiverEvaluationScriptError: 4
  • Previous by thread: Re: Opening and closing applications periodically
  • Next by thread: Re: applescript-users digest, Vol 3 #1831 - 1 msg
  • Index(es):
    • Date
    • Thread