# Run certain command on boot up?



## Sunnz (Oct 21, 2009)

I want my system (10.6.x) to run something like `/sbin/ifconfig lo0 alias 127.0.0.2` at start up.

I notice that I can possibly put that command into /etc/rc.common, but there are not rc.local or something similar to that which can be found on an usual BSD system... and /etc/rc.common is already populated with a bunch of stuff, so I am wondering if there is a recommended way to do this?

Full story:
I am actually accessing my remote drive on a Samba server, and I like to do this over SSH since I would always leave the SSH port open and I like to use that instead of having another service and port open for Samba. So every time I want to access Samba I SSH into my remote machine, with the option `-L 127.0.0.2:4445:127.0.0.1:445`, on my Mac I just open Finder and connect to smb://127.0.0.2:4445.

I need SSH to listen on 127.0.0.2 on my Mac instead of 127.0.0.1 because Finder is actually smart enough to see and tell you that 127.0.0.1 is the local machine anyway, that it actually tell you to just to grab the file locally. Unfortunately Finder is not smart enough to realise the possibility of the traffic being tunnel through SSH to a remote server.

So listening on 127.0.0.2 (an alias on lo0) is a workaround... but if there is a better way to do this, that would be good too.

Thanks!!


----------



## ElDiabloConCaca (Oct 21, 2009)

You want launchd:

http://developer.apple.com/macosx/launchd.html


----------

