Remote control over a network

Posted:
in Genius Bar edited January 2014
Is it possible to use the terminal or otherwise to launch an application on another computer over a network to run on that computer.



Here's why: I want to use a computer as a mp3 server with iTunes. But if that computer has been used, rebooted or something iTunes may not be running. So I want to launch it from my desk.



I thought it would be possible by logging into the computer at the terminal like so



& ssh [computer name]

user@computername password:

[computer name:~] username%

open /Applications/iTunes



but then i get:



kCGErrorIllegalArgument : initCGDisplayState: cannot map display interlocks.

kCGErrorIllegalArgument : CGSNewConnection cannot get connection port

INIT_Processeses(), could not establish the default connection to the WindowServer.Abort





Is there a different command needed to do this on a remote computer (like cp is scp) and is the above error message trying to tell me that it cannot open the application on my computer over the network, which is not what I want to do?

If there is no solution i'll just have to do it manually (simply not as fun), but i'd have thought it possible, surely if you can reboot a machine remotely you can run a program like iTunes without actually being there or is it only programs that run within Terminal?

Comments

  • Reply 1 of 4
    baumanbauman Posts: 1,248member
    Try this:

    Code:


    % /Applications/iTunes.app/Contents/MacOS/iTunes &







    This should open iTunes and background it, returning you to the prompt. You can then exit the shell without iTunes closing.



    You can even run AppleScripts through the terminal. Just do:

    Code:


    % osascript -e 'tell application "iTunes" to playpause'







    You can run any regular applescript this way.
  • Reply 2 of 4
    scott_rscott_r Posts: 98member
    You can use VNCthing from the system you are working on and OSXvnc to control the remote Mac on the other end. There are is programs (can't remember the name right now) that will let you send a "Wake on Lan" signal to the remote Mac and wake it up from sleep (not from turned off though, has to be in sleep mode or at least my iMac DV works that way.)



    I can wake my Mac from my pc and control it just as sitting in front of it. I can control my PC from the Mac. This may not be the most elegant way to do this, especially if someone is using the machine you want to control. But if you just want to control it, this works very well.



    You can also get a utility called "Sleeptight" that will lock the screen and put the remote Mac to sleep. I can run this command from my PC or directly at the Mac key board.



    Since using these utilities I haven't even had to go anywhere near my Mac some days! Note: you have to make sure that OSXvnc is running on the remote Mac before trying to control it. You can sleep the Mac with it running and takes about 5-10 seconds from waking the Mac that you can log in it form another machine.



    HTH,



    -Scott
  • Reply 3 of 4
    dnisbetdnisbet Posts: 201member
    Quote:

    Originally posted by bauman

    Try this:

    Code:


    % /Applications/iTunes.app/Contents/MacOS/iTunes &







    This should open iTunes and background it, returning you to the prompt. You can then exit the shell without iTunes closing.



    You can even run AppleScripts through the terminal. Just do:

    Code:


    % osascript -e 'tell application "iTunes" to playpause'







    You can run any regular applescript this way.



    Tried the terminal method over ssh in the terminal, unfortunately no luck got similar errors to before.



    scott, am downloading the programs will post what happens
  • Reply 4 of 4
    dnisbetdnisbet Posts: 201member
    Quote:

    Originally posted by scott_r

    You can use VNCthing from the system you are working on and OSXvnc to control the remote Mac on the other end. There are is programs (can't remember the name right now) that will let you send a "Wake on Lan" signal to the remote Mac and wake it up from sleep (not from turned off though, has to be in sleep mode or at least my iMac DV works that way.)







    Installed the combo of server and client and it works very very nicely. Shame I couldn't manage to do it in the Terminal. Something to ponder over, VNC is probably a more 'mac' way of doing it anyways!



    Thanks for everyone's help



    Dan
Sign In or Register to comment.