How to quit application on remote Mac or reboot such remote Mac?

How to quit a particular application on a remote Mac or reboot such remote Mac?

Is it possible via Telnet? How?

The remote Mac is in a local network via ADSL-Router with NAT.

Both Macs have Mac OS X 10.4.8.

Thanks.

Mac mini 1.83 GHz Intel Core Duo (2 GB RAM/80 GB HD), Mac OS X (10.4.8), Booting from external Firewire disk

Posted on Oct 13, 2006 1:23 AM

Reply
6 replies

Oct 13, 2006 2:09 AM in response to Gabriel Dorado

First, forget telnet. No Mac should be running telnet.

Secondly, you say the remote Mac is 'in a local network via ADSL'.

Do you mean it's local (i.e. both Macs are on the same network), or it's behind some other DSL router that's running NAT?

If it's local you shouldn't have a problem, but if it is remote you need to setup port forwarding so that you can get to it from the outside. Which ports you need to forward depends on the method you use to quit the other app, of which there are several.

All options require some kind of remote access protocol to be enabled. If the machine isn't running SSH, for example, you won't be able to ssh into the machine anyway.

The crudest option is to ssh into the remote machine and just issue a kill command. kill requires the PID (process ID) of the application you're trying to quit, so you can either use ps to find the process ID, or use killall which takes a process name.

Kill will simply terminate the app, so any unsaved data will be lost.

SSH requires port 22 to be forwarded to the internal machine.

A gentler approach would be to use AppleScript to tell the application to quit.
If Remote Apple Events are enabled on the machine, and port 3031 is forwarded in your router, you can use something like this in Script Editor:

<pre class=command>tell application "appName" of machine "eppc://ip.address.of.remote.mac/" to quit</pre>

This will gracefully tell the application on the remote machine to quit. However, it may prompt the user to save unsaved data, and may hang if there's no one there to acknowledge the request.
Depending on the application in question you may be able to get around that - some applications support a 'saving' parameter to the quit command - tell application... to quit saving no - but you'd need to check the specific application directory to see if this is supported or not.

Oct 13, 2006 5:17 AM in response to Camelot

Camelot,

Thanks.

The configuration is:

Outside phone line --- house phone line -- ADSL Router with NAT -- Connected to one computer via Ethernet and to the other computer via another Ethernet port.

So, both Macs have a common IP for the outside world and each one has a local IP (the router has another local IP):

192.168.1.1 <-- ADSL Router
192.162.1.2 <-- Mac
192.168.1.3 <-- This is the "remote" Mac

Both Macs are running Timbuktu Pro and I can see the remote Mac with such application, but only the Desktop is shown and it is "frozen" since clicking any item does nothing.

The AppleScript

tell application "EndNote X.app" of machine "eppc://192.168.1.3/" to quit

gives the error:

Remote access isn’t allowed

Oct 13, 2006 7:19 PM in response to Gabriel Dorado

So, both Macs have a common IP for the outside world and each one has a local IP (the router has another local IP):

OK, so they're on the same LAN - that makes thinks simpler.

>Both Macs are running Timbuktu Pro and I can see the remote Mac with such application, but only the Desktop is shown and it is "frozen" since clicking any item does nothing.

It sounds like the system has hung. If that's the case it won't respond to any input.

>The AppleScript...gives the error:
Remote access isn’t allowed


Then Remote Apple Events are not enabled on the remote machine (which is the default mode, so it's not all that surprising).

Since the machines are local, do you have any better luck with a keyboard and monitor attached to the machine itself? If not it sounds like it's time to pull the plug.

Oct 14, 2006 12:44 AM in response to Camelot

Thanks.

No way using the remote Mac keyboard and mouse. The Mac seems to wake up (the power light stops flashing), but the screen remains black (although changes from full black corresponding to the off state os sleeping to a less-black state, meaning that some electricity input is received when wakening).

I have tested on other computers set in a similar way and if I activate "Apple/System Preferences/Sharing/Remote Apple Events" on the remote Mac, then the Script Editor gives me a different error:

"Unable to authenticate user"

Any way to prevent such error? Just for future reference...

Thanks again.

Oct 15, 2006 11:06 AM in response to Gabriel Dorado

"Unable to authenticate user"

This usually means that the username you're executing the script as doesn't have a corresponding account on the remote machine. For example, if you're using a username 'gabriel' on your machine, you'd also need a 'gabriel' account on the remote machine. If you don't have one, you can't log in for the script to execute.

The simplest solution would be to add an account on the remote machine. The other is to tell the script which username to log in as, in the form:

<pre class=command>tell application "blah" of machine "eppc://username:password@ip.of.remote.mac/"...</pre>

Oct 15, 2006 11:46 AM in response to Camelot

Thanks. Yet, it did not work. As as example, I get "AppleEvent timed out" when running the AppleScript:

tell application "Safari.app" of machine "eppc://username:password@192.168.1.2/" to quit

Even when the remote Mac is working normally (using the corresponding username and password). Note that the IP "192.168.1.2" is the local one; not the "external" to Internet, since the latter is shared between both Macs.

Any idea why it did not work? Thanks again.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to quit application on remote Mac or reboot such remote Mac?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.