 |
 |
Start terminal application on boot?
|
 |
|
 |
|
Senior User
Join Date: Mar 2001
Location: Crystal, MN
Status:
Offline
|
|
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
|
|
You could write an apple script to do it then set the applescript in the startup items folder..
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Mar 2001
Location: Crystal, MN
Status:
Offline
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 ?
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Mar 2001
Location: Crystal, MN
Status:
Offline
|
|
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
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|