• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Scripting a command to unix with sudo fun
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting a command to unix with sudo fun


  • Subject: Re: Scripting a command to unix with sudo fun
  • From: John W Baxter <email@hidden>
  • Date: Thu, 14 Mar 2002 22:31:05 -0800

At 21:01 -0600 3/14/2002, garrett wrote:
>EXAMPLE 2:
>directly from AS using the command do shell script. Since I'm real
>unfamiliar with unix, am i running 2 processes here, the LaunchCFMApp
>process and then Rumpus.? so if i were to manually quit Rumpus from the
>program, does it leave the LaunchCFMApp running? i know if i use example
>one, by closing the terminal window, i'm killing the whole process.
>
> do shell script "sudo
>/System/Library/Frameworks/Carbon.framework/Versions/A/Support/LaunchCFMApp
>/Applications/Utils-Network/RumpusServer/Rumpus2.1Carbon ; mypassword"
>
>
>Ok. This works. However, how can i script the system to tell me just what
>process it created, so i can later use that PID to kill it? for example
>the LaunchCFMApp is running many times on a typical system, so how do i
>identify the one i just launched... is there some feedback that i can get
>back from the do shell script command that will give me the info i need?
>or is it ok to just kill the app Rumpus and leave that LaunchCFMApp
>process going?

I think you're working too hard:

do shell script: execute a shell script or command (defined in:
StandardAdditions.osax)
do shell script string -- the command or shell script to execute.
Examples are 'ls' or '/bin/ps -auxwww'
[administrator privileges boolean] -- execute the command as the
administrator
[password string] -- use this administrator password to avoid a
password dialog
[Result: string] -- the command output

That should take care of the sudo and the password it needs.

Then, consider something like
open /Applications/Utils-Network/RumpusServer/Rumpus2.1Carbon
as the shell script. (Tested in Terminal just now with Stickies.)

(UNTESTED)

So the whole thing would be
do shell script "open
/Applications/Utils-Network/RumpusServer/Rumpus2.1Carbon" with
administrator privileges password "notthistime"

Beware the evil line wrap...that's all on one line.

--John

--
John Baxter email@hidden Port Ludlow, WA, USA
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Getting a PID and killing a process (Was: Re: Scripting a command to unix..)
      • From: Hiram <email@hidden>
References: 
 >Scripting a command to unix with sudo fun (From: garrett <email@hidden>)

  • Prev by Date: Re: AS: Compiled or interpreted?
  • Next by Date: Re: FADE DEAD
  • Previous by thread: Scripting a command to unix with sudo fun
  • Next by thread: Getting a PID and killing a process (Was: Re: Scripting a command to unix..)
  • Index(es):
    • Date
    • Thread