Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A script to keep iCal's dock icon current' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to keep iCal's dock icon current
Authored by: bluehz on Feb 20, '03 01:47:32PM
I really like AppleScript and have used it for years - but speedwise, when you put an Applescript up against a shell script - the shell script is just much faster. I try to do all my scripting in the shell - sometimes more succesful than others. Here's the same thing as above in a shell script
#!/bin/sh
#
# Name: fix-ical
# Launches ical and immediately quits to aid
# in fixing the stuck dock icon
#
# Save this script as "fix-ical" in you ~/Library/bin
# change permissions to executable
# Set to run from a cron task
#
# the script is set to pause 10 secs after launching ical
# this can be adjusted to taste per your machine

/Applications/iCal.app/Contents/MacOS/iCal &
sleep 10 
ps -ax | grep iCal | grep -v grep | awk '{print $1}' | xargs kill -9



[ Reply to This | # ]
is the kill -9 necessary?
Authored by: imacusr on Feb 20, '03 09:14:27PM

I was under the impression one should try to avoid kill -9'ing a process if a regular kill command would work. Does iCal not respond to a simple kill signal? Just curious.



[ Reply to This | # ]
is the kill -9 necessary?
Authored by: bluehz on Feb 21, '03 08:40:40AM

Good point and I actually thought of that as soon as I posted it. It might be better to use a kill -3 (quit) or kill -15 (terminate). I tried uisng kill -3 and it had no effect - but kill -15 worked fine. Does anyone know the pros and cons of doing a kill -15 on a running app?



[ Reply to This | # ]
Kill -15 is clean
Authored by: watson on Feb 21, '03 01:29:55PM

kill -15 (SIGTERM) is the default signal sent by the kill program, allowing the program to do a clean exit, save its state, data and so on.
Kill -9 on the other hand, it only needed for hung applications, when it's not responding to anything else. The -9 (SIGKILL) signal is not catchable and the application is given no chance of saving any state or data.

To get a list of available signals, try a 'kill -l' (without quotes) in the terminal.

HTH,
Henrik



[ Reply to This | # ]
Kill -15 is clean
Authored by: sxtxixtxcxh on Apr 13, '04 01:02:31AM
i get a mail from the cron daemon saying:

/Users/stitch/ical_icon: line 16:  4458 Terminated              /Applications/iCal.app/Contents/MacOS/iCal
i'd hate to have a new one each day...

[ Reply to This | # ]
A script to keep iCal's dock icon current
Authored by: bluehz on Feb 26, '03 08:08:22AM

This script is working, teh icon is changing, BUT it is reverting BACK to the old number soon after. Wonder where that info is stored.



[ Reply to This | # ]