image
image

Go Back   macosx.com > Mac Help Forums > Unix & X11

Reply
 
LinkBack Thread Tools
  #1  
Old May 5th, 2009, 09:51 AM
Registered User
 
Join Date: May 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
bencaro is on a distinguished road
Run a unix command on startup

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,
Reply With Quote
  #2  
Old May 5th, 2009, 02:00 PM
Registered User
 
Join Date: Mar 2005
Posts: 252
Thanks: 0
Thanked 5 Times in 5 Posts
artov is on a distinguished road
Manual says to use /etc/rc.local, but I guess Tiger and Leopard do not use it any more. Little searching gave following web page http://developer.apple.com/MacOsX/launchd.html. I did not try it, so tell us how it works.
Reply With Quote
  #3  
Old July 10th, 2009, 08:39 PM
russell23's Avatar
Registered User
 
Join Date: Jul 2009
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
russell23 is on a distinguished road
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.
Reply With Quote
  #4  
Old September 19th, 2009, 05:08 PM
Registered User
 
Join Date: Sep 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ahawkes is on a distinguished road
Run a shell script at login

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/libra...02134-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!


Quote:
Originally Posted by bencaro View Post
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,
Reply With Quote
Reply

Bookmarks

Thread Tools

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump


All times are GMT -5. The time now is 10:28 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC1
Copyright 2000-2010 DigitalCrowd, Inc.