Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 4, 2008, 10:48 PM   #1
michaelzz
macrumors newbie
 
Join Date: Apr 2008
AppleScript Terminal Commands

Hi,
I have 2 commands in terminal i use often and I would like to automate them with an applescript (or shell script, or a script of some sort). I tried apple script and put this in

Code:
do shell script "sudo ipfw pipe 1 config bw 50KByte/s"
do shell script "sudo ipfw add 1 pipe 1 src-port 80"
then i try to run it in the editor and it says "error: Password: ". so i was wondering if there was someway to add a password into the script (i don't care too much about security), or find a way around this. I would rather not type my password every time i try to run the script, but it would be fine if I had to.
Thanks in advance!
michaelzz is offline   0 Reply With Quote
Old Jul 5, 2008, 02:38 AM   #2
HiRez
macrumors 601
 
HiRez's Avatar
 
Join Date: Jan 2004
Location: Western US
Use the with administrator privileges, user name, and password keywords, and don't use sudo:

http://developer.apple.com/technotes/tn2002/tn2065.html
__________________
Go outside, the graphics are amazing!
HiRez is offline   0 Reply With Quote
Old Jul 5, 2008, 10:57 PM   #3
michaelzz
Thread Starter
macrumors newbie
 
Join Date: Apr 2008
i got an error after i did that
Code:
ipfw: socket: operation not permitted
michaelzz is offline   0 Reply With Quote
Old Jul 6, 2008, 02:14 AM   #4
HiRez
macrumors 601
 
HiRez's Avatar
 
Join Date: Jan 2004
Location: Western US
Well I'm sorry, I don't know anything about that error, but using those keywords is the normal way to do such things from AppleScript. Maybe certain commands have issues with it. Can you try running the script from the root account and see if it still gives you the error?
__________________
Go outside, the graphics are amazing!
HiRez is offline   0 Reply With Quote
Old Jun 27, 2011, 07:18 PM   #5
HeyPretty
macrumors newbie
 
Join Date: Jun 2011
No need for an AppleScript here. Just add an alias in your .profile:

http://ss64.com/bash/alias.html

alias config='sudo ipfw pipe 1 config bw 50KByte/s'
alias add='sudo ipfw add 1 pipe 1 src-port 80'
HeyPretty is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Similar Threads
thread Thread Starter Forum Replies Last Post
Terminal Command Not Working In 10.6.8? SinisterPower MacBook Pro 3 Jul 9, 2011 10:12 AM
Python terminal command? lynkynpark86 Mac Programming 2 May 28, 2011 04:28 PM
Where can I find a guide to Terminal Commands? ryanflucas OS X 4 Apr 27, 2011 05:43 PM
How do I run these terminal commands in AppleScript Editor? pcs are junk Mac Programming 10 Feb 17, 2010 08:41 PM
Simple question about applescripting a terminal command sitryd Mac Programming 5 Nov 1, 2007 11:50 AM


All times are GMT -5. The time now is 11:34 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC