Startup script

mala

Registered
Hi,

what would be the best way to add a user independent startup scrip to be run at bootup? In this case I'd like to run a script that does "sudo snmpd ---- password".

TIA

Mans
 
In your home folder, make a '.login' file and dump whatever command you want to execute on startup in it.

A while since I did it (and my mac is not here for the moment), but that should do the trick.

and; Think you have to add #!/bin/sh to the top of the file.
(damn my memory is bad)

NuCleuZ
 
start the shell....


best thing to do is look at the scripts in /System/Library/StartupItems

you should see an item which is set to user root and chmod 755

then there are one or more plist and lproj files with some configurable strings.

you should duplicate the style of one of those services and also make a suitable
entry in hostconfig

like

SNMPSERVER=-YES-

then you script should make reference to that same name
as in
if{SNMPSERVER=-YES-?"-NO-"} then.....
check the other files for correct syntax...

then you should be able to test your script by running it as root or sudo

and then manually shutting down the server to try again...

then restart and if you added text entries you should see

Starting SNMP....
Flash by....

read some docs somewhere in the developer literature...


also,

when init or root user uses sudo

no password is required so you don't have to write the password down in plain text in any file.


happy happy
 
Back
Top