Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rate Thread Display Modes
Old 07-17-2004, 05:52 AM   #1
JazzDude
Triple-A Player
 
Join Date: Jan 2002
Location: Germany
Posts: 55
Unhappy why can't I kill this process?

I have two machines, "powerbook" and "imac". There's a process running on powerbook called 'Microsoft Database Daemon' (MDD). It has the PID 1234. I can ssh from imac to powerbook and get a shell without entering a password.
Code:
ssh powerbook
Then, at the prompt I can type
Code:
killall 'Microsoft Database Daemon'
and the process gets killed.

I can also type
Code:
ssh powerbook kill 1234
to kill the MDD on powerbook. Note that this is a one-liner without further interaction required.

I can also type
Code:
ssh powerbook killall TextEdit
to kill TextEdit on the other machine. One-liner again, works.

Now, what doesn't work is
Code:
ssh powerbook killall 'Microsoft Database Daemon'
and I can't figure out why. Can anyone please enlighten me?
__________________
iMac 20" 2.66, 4GB, 10.6.x
MacBook 2.0, 2GB, 10.6.x
G4 466, 896MB, 10.4.x
PowerBook G3 333, 256MB, 10.3.x
assorted other older Macs
JazzDude is offline   Reply With Quote
Old 07-17-2004, 06:59 AM   #2
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,415
It seems likely that this is due to the spaces in the name of the process.
hayne is offline   Reply With Quote
Old 07-20-2004, 03:22 AM   #3
DoubleEdd
Major Leaguer
 
Join Date: Nov 2002
Posts: 285
It's perhaps because the 's get interpreted by the shell at this end in order to make that all one argument to the command, but you need to get it interpreted by the shell at the other end. Try escaping the 's, eg

ssh powerbook killall \'Microsoft Database Daemon\'
DoubleEdd is offline   Reply With Quote
Old 07-20-2004, 03:29 AM   #4
JazzDude
Triple-A Player
 
Join Date: Jan 2002
Location: Germany
Posts: 55
Yee-haw! That did it! I tried escaping the blanks before but never the single quotes. Cool!
__________________
iMac 20" 2.66, 4GB, 10.6.x
MacBook 2.0, 2GB, 10.6.x
G4 466, 896MB, 10.4.x
PowerBook G3 333, 256MB, 10.3.x
assorted other older Macs
JazzDude is offline   Reply With Quote
Old 07-20-2004, 03:37 AM   #5
JazzDude
Triple-A Player
 
Join Date: Jan 2002
Location: Germany
Posts: 55

Now I need to find a way to issue this command in AppleScript.
Code:
do shell script "ssh powerbook killall \'Microsoft Database Daemon\'"
won't do it since the escape characters aren't recognized. Is there a way to escape the escapes in AS?
JazzDude is offline   Reply With Quote
Old 07-20-2004, 03:43 AM   #6
DoubleEdd
Major Leaguer
 
Join Date: Nov 2002
Posts: 285
Put the command in a script, eg

#!/bin/sh
ssh powerbook killall \'whatever it is\'

then chmod +x it, and call that from the AS?
DoubleEdd is offline   Reply With Quote
Old 07-20-2004, 04:23 AM   #7
JazzDude
Triple-A Player
 
Join Date: Jan 2002
Location: Germany
Posts: 55
I found the solution on one of Apple's developer pages: just escape the escape characters:
Code:
do shell script "ssh powerbook killall \\'Microsoft Database Daemon\\'"
Now my little AppleScript is ready. I will post it as a hint since there must be a lot of users with Entourage and two or more Macs...
JazzDude is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting 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

Forum Jump



All times are GMT -5. The time now is 09:01 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.