image
image

Go Back   macosx.com > Mac Help Forums > Mac OS X System & Mac Software

Reply
 
Thread Tools
  #1  
Old December 2nd, 2005, 12:15 PM
Registered User
 
Join Date: Nov 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
ottoguy is on a distinguished road
Run a script at startup?

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
Reply With Quote
  #2  
Old December 2nd, 2005, 12:23 PM
MyMacBlog.com
 
Join Date: Apr 2005
Location: New Jersey, USA
Posts: 536
Thanks: 0
Thanked 0 Times in 0 Posts
dmetzcher is on a distinguished road
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).
__________________
Dennis R. Metzcher
MyMacBlog.com: My experiences with the Mac OS, a switcher's point of view. With a new Mac tip each week day.
Reply With Quote
  #3  
Old December 2nd, 2005, 12:34 PM
Registered User
 
Join Date: Nov 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
ottoguy is on a distinguished road
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?
Reply With Quote
  #4  
Old December 2nd, 2005, 01:19 PM
MyMacBlog.com
 
Join Date: Apr 2005
Location: New Jersey, USA
Posts: 536
Thanks: 0
Thanked 0 Times in 0 Posts
dmetzcher is on a distinguished road
Quote:
Originally Posted by ottoguy
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?
__________________
Dennis R. Metzcher
MyMacBlog.com: My experiences with the Mac OS, a switcher's point of view. With a new Mac tip each week day.
Reply With Quote
  #5  
Old December 2nd, 2005, 01:37 PM
Registered User
 
Join Date: Nov 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
ottoguy is on a distinguished road
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?
Reply With Quote
  #6  
Old December 4th, 2005, 12:58 PM
MyMacBlog.com
 
Join Date: Apr 2005
Location: New Jersey, USA
Posts: 536
Thanks: 0
Thanked 0 Times in 0 Posts
dmetzcher is on a distinguished road
Quote:
Originally Posted by ottoguy
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.
__________________
Dennis R. Metzcher
MyMacBlog.com: My experiences with the Mac OS, a switcher's point of view. With a new Mac tip each week day.
Reply With Quote
  #7  
Old December 4th, 2005, 03:46 PM
MyMacBlog.com
 
Join Date: Apr 2005
Location: New Jersey, USA
Posts: 536
Thanks: 0
Thanked 0 Times in 0 Posts
dmetzcher is on a distinguished road
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/Documentat...utomation.html
__________________
Dennis R. Metzcher
MyMacBlog.com: My experiences with the Mac OS, a switcher's point of view. With a new Mac tip each week day.
Reply With Quote
Reply

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


All times are GMT -5. The time now is 02:25 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.