Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > How to remotely quit an application ?

How to remotely quit an application ?
Thread Tools
turtle777
Clinically Insane
Join Date: Jun 2001
Location: planning a comeback !
Status: Offline
Reply With Quote
Mar 30, 2008, 01:46 PM
 
So, here's my problem:

I'm using OmniFocus, which creates a lock file as long as the database file is open. The lock file is deleted once you quit the application.

If I'm on a different computer, and I want to access this database, I can't do so until OmniFocus running on the other computer has quit.

How can I remotely "quit" that OmniFocus instance w/o using a screen sharing app or Remote Desktop ?

I tried various versions of kill (kill -1, kill -3, kill -9), but they all basically crash OmniFocus, and don't shut it down gracefully. The lock file is never deleted, and unsaved changes are not saved (which is the worse part).

I tried AppleScript, but when I execute the script (tell application "OmniFocus" quit), it wants to quit OmniFocus on the computer I started the script from, not the remote computer.

I would really need some Unix based way of telling the app to quit in a normal and regular fashion. HOW ?

-t
     
turtle777  (op)
Clinically Insane
Join Date: Jun 2001
Location: planning a comeback !
Status: Offline
Reply With Quote
Mar 30, 2008, 02:02 PM
 
In addition, is there a way to quit an application automatically when Fast User Switching is used to switch to a different user ? I only remember than WinSwitch was able to do that, but it's not Leopard compatible.

-t
     
pat++
Mac Elite
Join Date: May 2001
Location: Earth
Status: Offline
Reply With Quote
Mar 31, 2008, 08:09 PM
 
Try kill -TERM (but it's likely not going to work better than kill -1 (HUP))
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Mar 31, 2008, 08:21 PM
 
Maybe osascript -e 'tell application "OmniFocus" to quit' will work.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
turtle777  (op)
Clinically Insane
Join Date: Jun 2001
Location: planning a comeback !
Status: Offline
Reply With Quote
Mar 31, 2008, 09:30 PM
 
Originally Posted by Chuckit View Post
Maybe osascript -e 'tell application "OmniFocus" to quit' will work.
But if I run that script from a Mac A, how do I tell the script to quit the app on Mac B ?

-t
     
dimmer
Mac Enthusiast
Join Date: Feb 2006
Status: Offline
Reply With Quote
Mar 31, 2008, 09:44 PM
 
Try this - the poster seems to think this would require allowing remote Apple Events, but I'm not so sure that it would. Worth a try.
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Mar 31, 2008, 09:54 PM
 
Originally Posted by turtle777 View Post
But if I run that script from a Mac A, how do I tell the script to quit the app on Mac B ?

-t
I assumed you were ssh'ed in for the kill commands. That was meant as an OS X-friendly alternative to kill.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
turtle777  (op)
Clinically Insane
Join Date: Jun 2001
Location: planning a comeback !
Status: Offline
Reply With Quote
Apr 12, 2008, 12:38 PM
 
Originally Posted by Chuckit View Post
Maybe osascript -e 'tell application "OmniFocus" to quit' will work.
Tried that, no dice. Some weird error message.

[iMac:~] turtle777% osascript -e 'tell application "OmniFocus" to quit'

2008-04-12 12:35:18.295 osascript[26414:807] Error loading /Users/turtle777/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX: dlopen(/Users/turtle777/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX, 262): no suitable image found. Did find:
/Users/turtle777/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX: mach-o, but wrong architecture
osascript: OpenScripting.framework - scripting addition /Users/turtle777/Library/ScriptingAdditions/24U Appearance OSAX.osax declares no loadable handlers.



I think the 24U Appearance OSAX is a third party app. Let me see if I need a new version.

-t
     
turtle777  (op)
Clinically Insane
Join Date: Jun 2001
Location: planning a comeback !
Status: Offline
Reply With Quote
Apr 12, 2008, 12:46 PM
 
Installed the latest version of the 24U Appearance OSAX, still doesn't work.

I don't understand why 24U is even being called up.

-t
     
turtle777  (op)
Clinically Insane
Join Date: Jun 2001
Location: planning a comeback !
Status: Offline
Reply With Quote
Apr 12, 2008, 12:53 PM
 
Ok, got it to work.
Had to disable this darn 24U script. Don't even know why I used it in the first place.

Logged in via SSH and then used
osascript -e 'quit application "OmniFocus"'

It did the job.

Thanks, guys.

-t
     
   
 
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -4. The time now is 01:43 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,