Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Start terminal application on boot?

Start terminal application on boot?
Thread Tools
Senior User
Join Date: Mar 2001
Location: Crystal, MN
Status: Offline
Reply With Quote
Apr 13, 2003, 03:08 PM
 
OK, so this one should be really easy and I searched the forums, but either put in the wrong words or am really stupid...

So here goes,

I am setting up Nagios (Network Monitoring software) and need to launch the program each time the workstation boots. The command is:

./nagios ../etc/nagios.cfg

and of course, you need to the in the correct directory, which is:

/netsaint/local/nagios/bin/

Thanks,

dw9
     
Junior Member
Join Date: Aug 2002
Location: 127.0.0.1
Status: Offline
Reply With Quote
Apr 13, 2003, 07:10 PM
 
You could write an apple script to do it then set the applescript in the startup items folder..
     
dawho9  (op)
Senior User
Join Date: Mar 2001
Location: Crystal, MN
Status: Offline
Reply With Quote
Apr 14, 2003, 06:25 AM
 
Originally posted by Colonel_Panic:
You could write an apple script to do it then set the applescript in the startup items folder..
I did not know that the terminal was a scriptable application. I will have to look into that.

Thanks,

dw9
     
Mac Enthusiast
Join Date: Jul 2001
Location: Atlanta, GA
Status: Offline
Reply With Quote
Apr 14, 2003, 08:12 AM
 
Originally posted by dawho9:
I did not know that the terminal was a scriptable application. I will have to look into that.

Thanks,

dw9
It's fairly simple to do. If you want it in terminal you can do it like this:

tell application "Terminal"
activate
do script "cd /Folding;./folding -local -advmethods"
do script "cd /Folding2;./folding -local -advmethods"
end tell

This is my script for kicking off my folding when I login. If you want it to run as a background task without terminal you can do it like this:

do shell script "cd /Folding;./folding -local -advmethods"

Just two quick examples that might help.
     
Mac Enthusiast
Join Date: Sep 2000
Location: France
Status: Offline
Reply With Quote
Apr 16, 2003, 06:18 PM
 
You could also create a Startup Item in /Library/StartupItems. That way the script will launch during boot-up (before the login screen), unlike the other solutions described above, which launch your program when somebody logs in and abort it when they log out.
Just create a folder named Nagios in /Library/StartupItems.
In that folder, create two text files, one named "Nagios", and the other "StartupParameters.plist"

Here's what Nagios should look like :
Code:
#!/bin/sh cd /netsaint/local/nagios/bin/; ./nagios; ../etc/nagios.cfg;
And here's "StartupParameters.plist" :
Code:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> <plist version="0.9"> <dict> <key>Description</key> <string>Nagios</string> <key>Messages</key> <dict> <key>start</key> <string>Launching Nagios</string> <key>stop</key> <string>Stopping Nagios</string> </dict> <key>OrderPreference</key> <string>Last</string> <key>Provides</key> <array> <string>Nagios</string> </array> <key>Requires</key> <array> <string>Network</string> </array> </dict> </plist>
Don't forget to add execution permissions to the first file with chmod.
Hope that helps...
     
Professional Poster
Join Date: Jun 2000
Status: Offline
Reply With Quote
Apr 17, 2003, 12:40 AM
 
Originally posted by Axel:

Don't forget to add execution permissions to the first file with chmod.
So it's clear for other people (and to answer my question), does this mean chmod +x on the file?
     
Mac Enthusiast
Join Date: Sep 2000
Location: France
Status: Offline
Reply With Quote
Apr 17, 2003, 04:39 AM
 
Originally posted by bradoesch:
So it's clear for other people (and to answer my question), does this mean chmod +x on the file?
Exactly. Maybe it would be even better to first change the owner to both files using :
chown root filename
and then do a :
chmod u+x Nagios
to ensure that only the superuser can launch this script, but I'm not sure that's how startup items should be configured, permission-wise.
Any ideas from other people ?
     
dawho9  (op)
Senior User
Join Date: Mar 2001
Location: Crystal, MN
Status: Offline
Reply With Quote
Apr 18, 2003, 10:34 AM
 
Originally posted by Axel:
Exactly. Maybe it would be even better to first change the owner to both files using :
chown root filename
and then do a :
chmod u+x Nagios
to ensure that only the superuser can launch this script, but I'm not sure that's how startup items should be configured, permission-wise.
Any ideas from other people ?
Perfect! It works great. Thanks everyone.

dw9
     
   
Thread Tools
Forum Links
Forum 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 On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:55 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2