Run a script at startup?

ottoguy

Registered
I am sure this has been discussed before, but when i try to do a search it says it is disabled. So sorry for a repost.

I want to run a script I wrote at startup with root or sudo privilage. Is there a tutorial or something on how to do this or can someone explain it?
Thanks
Scott
 
What about creating an AppleScript and adding it to your Account's Login Items? You can use the "do shell script" command in the AppleScript code, and then put whatever shell commands you want in there, as if you were typing them into the Terminal. You could also save the script as an app and then add it. Either way, check the box next to it when you add it to the Login Items (Startup Items, I believe, in Panther), if you don't want to see it run (it will be hidden if checked).
 
I'm running OS X 10.4.3 on a mac mini by the way. I saw the start with login option, but I probably won't be always logging into the box. I'm using it for network monitoring at remote sites, so it will basicly just sit there collect data and send it back to my server. So if the power flips off and on or something, I would like it to re-start the collection tool without me haveing to log into the machine.

Side note, anyone know why search is disabled?
 
ottoguy said:
I'm running OS X 10.4.3 on a mac mini by the way. I saw the start with login option, but I probably won't be always logging into the box. I'm using it for network monitoring at remote sites, so it will basicly just sit there collect data and send it back to my server. So if the power flips off and on or something, I would like it to re-start the collection tool without me haveing to log into the machine.

Side note, anyone know why search is disabled?
How about adding the script to the system crontab? It could run it for you. I don't know how cron runs that crontab. Try CronniX to edit the crontab. Be careful that you edit the system crontab though, because it edits your user crontab by default. Someone else would need to answer this question:

Will the system crontab be run if no one is logged into the machine? Is cron even running if someone is not logged into the machine?
 
Isn't cron just to schedule jobs on a time basis, not on startup? Can cron be used to schedule something to start with the system or only at a specified time?
 
ottoguy said:
Isn't cron just to schedule jobs on a time basis, not on startup? Can cron be used to schedule something to start with the system or only at a specified time?
Yes, I must not have been thinking when I wrote that. Cron won't work for you here.
Maybe someone else has a suggestion? There has to be a way to do this. Now I'm curious.
 
I found something that might help you. I was looking around for a way to automate a few things at login, but it turns out that you can write scripts that will automate things at startup, too. Startup is defined as booting the machine, so check out the link below for information on this type of thing. It looks a bit complicated, so I haven't had time to read it, but it might be a good place to start.

http://www.macos.utah.edu/Documentation/scripts/script_automation.html
 
Back
Top