running a command line app with sudo and password automatically on start up OS X (Lion)
Posted
by
Designer023
on Super User
See other posts from Super User
or by Designer023
Published on 2012-06-18T08:38:24Z
Indexed on
2012/06/18
9:18 UTC
Read the original article
Hit count: 164
I need to run an app at startup/login on my mac. I want it to launch in the background and start doing it's work without interrupting me or me having to start it up because I invariably forget and then when I need it, it wasn't running!
I have tried using applescript to tell terminal to run it and type my password in, but it ends up opening multiple Terminal windows and not working. Ideally I need a script that I can just add to the user login items and it will run for me.
The app has no way of taking a password argument either and it has a password as well as the sudo! I need a solution that can either be done as an applescript (which can be made into an executable) or i need a commandline script but I have no idea about them.
This is the manual code I type
>sudo serverStatus
>password:123456
>password:serverpass
Not sure if this is the right stack to ask, but I have no idea now and it's above my head!
Thanks :D
My applescript:
tell application Terminal
activate
do shell script "sudo serverStatus"
delay 5
do shell script "123456"
delay 2
do shell script "serverpass"
end tell
© Super User or respective owner