Run a unix command on startup

bencaro

Registered
Hi , i'm new here. I have a unix command line that i use to cut off internet access to my student in my class (about 40 macs) : ipfw add 2009 deny tcp from any to any 80 out xmit en0. This command must be launch as root (i use remote desktop to do it). It work's fine, but the only problem is when student restart there mac, internet is back online. Here is my question : Is there a way to run this unix command on startup?

I'm not to great with scripting and i have tried a program called Lingon, with no success and i have no support from my technician saying : « you're a mac user and i don't do support for you guys! ».

Thank you for reading me,
 
create a launchd.conf file, if one is not already existing (I believe, it should not exists, unless you or someone have created already).

Enter the command, which you want to run on startup.

It should work. Post back your experiences for the benefit of other members.
 
Well, it may be a bit late, but I have been trying to do something similar. I want to run a unix shell script at login. With a little research I found this page...

http://developer.apple.com/mac/libr...in.html#//apple_ref/doc/uid/20002134-BAJCGEGG

Which outlines several methods of customizing stuff at login. I eventually decided on the section called "Installing Scripts Using Defaults"

I created a folder at /Library/isc on the computer. I put a script called "wm" in that folder. Then "chmod 755 wm" to let any user run it. To test, I logged in as the end user, opened terminal and ran /Library/isc/wm. It worked fine.

Note that you must have the root account activated and know the password to do any of the rest...

Then, to set that script ("wm") to run at login, I opened terminal and ran

sudo defaults write com.apple.loginwindow LoginHook /Library/isc/wm
which asks for the root password.

That created an entry in /var/root/Library/Preferences/com.apple.loginwindow.plist
that runs the script at login.

I rebooted and it ran!

Keep in mind that your script is being run as root so don't do anything stupid!


Hi , i'm new here. I have a unix command line that i use to cut off internet access to my student in my class (about 40 macs) : ipfw add 2009 deny tcp from any to any 80 out xmit en0. This command must be launch as root (i use remote desktop to do it). It work's fine, but the only problem is when student restart there mac, internet is back online. Here is my question : Is there a way to run this unix command on startup?

I'm not to great with scripting and i have tried a program called Lingon, with no success and i have no support from my technician saying : « you're a mac user and i don't do support for you guys! ».

Thank you for reading me,
 
Back
Top