Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 4, 2008, 11: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, 03: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, 11: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, 03: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, 08: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

Similar Threads
thread Thread Starter Forum Replies Last Post
How to make commands With AppleScript? TannerWord OS X 10.8 Mountain Lion 5 Aug 31, 2014 02:42 PM
How to create an applescript for multiple dd terminal commands in sequence ? AlbertoBC Mac Programming 2 Feb 2, 2014 02:30 PM
General: FIX "Error opening terminal: xterm-256color" for Terminal Commands (e.g., "top") iOS7 thelatinist Jailbreaks and iOS Hacks 9 Jan 10, 2014 08:46 PM
Terminal commands dhokes OS X 6 Oct 21, 2013 11:24 AM
Terminal Commands: Networking related commands? MacNoobGuy OS X 3 Oct 27, 2012 10:10 AM

Forum Jump

All times are GMT -5. The time now is 08:40 PM.

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

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