tell droplet to quit on logout

Is there a way to tell a droplet that’s running to quit itself when I tell Panther to log out?

here’s the script, which we’re using to debug a nasty server-client error … we’d love it to quit itself if log out is attempted.

thanks!

tell application "Finder"
	try
		set Volumes to the name of every disk whose startup is false and name does not contain "Network"
		set Volumes to Volumes as list
	on error
		display dialog "There are no volumes mounted."
	end try
	repeat
		repeat with i from 1 to the count of Volumes
			set This_Volume to item i of Volumes
			--do shell script "ls /Volumes/" & """ & This_Volume & """
			do shell script "cd /Volumes/" & """ & This_Volume & """
			delay 10
		end repeat
	end repeat
end tell

Good question. There must be some direct way to catch the log out. Maybe someone will tell us.

How about launching an app that does respond to log-outs and then testing the process list to see if it’s still running. If not, exit the script.

Do you need to know the very second the server disconnects, or would checking once a minute be OK? If so, get rid of the outer repeat/end repeat and just cron the script to run once a minute. (Get yourself a copy of CronIX if you don’t do crontab/vi.)