Setting Env

Jerry McAllister jerrymc at msu.edu
Thu Mar 8 16:58:56 UTC 2007


On Thu, Mar 08, 2007 at 08:31:23AM -0800, Drew Jenkins wrote:

> ----- Original Message ----
> From: Garrett Cooper <youshi10 at u.washington.edu>
> To: freebsd-questions at freebsd.org
> Sent: Thursday, March 8, 2007 11:09:13 AM
> Subject: Re: Setting Env
> 
> > Well, it's going to involve a bit more than that to get an rc script up 
> > and running I'm afraid.. the script needs a start, stop, status 
> > functions, as well as a few others. Some examples are in the /etc/rc.d 
> > and /usr/local/etc/rc.d directories, as you've discovered.
> >
> > Given your output above, maybe you want to add the LD_LIBRARY_PATH lines 
> > to the zopectl file?
> 
> Brilliant! Why doesn't *that* work?! This is crazy! I even added your little script and, after it booted, tried running that directly (after stopping Zope) and it _still_ didn't work! That makes no sense to me at all! I put together a little script, as I stated earlier, that set the env, stopped and started my Zope instances (calling on zopectl), and *that* worked, so why doesn't this work?? That whole bin dir in Zope is owned by root, so how is running that script different than, as root, setting the env? Insane!
> Drew

I think this is really changing to getting a script to run at boot 
time from its previous 'setting env'.

Anyway, I suggest first just working on getting any script to run
at boot time - or rather at the time the system comes up for multi-
user, but that stuff does not run when it comes up to single-user.

So, my next suggestion is to make any little ole script with a couple
of echo-s in it to demonstration that it runs and put that it
the /usr/local/etc/rc.d directory with the correct permissions
and name, etc.   NOTE, someone in an earlier post clarified the .sh
issue with information that was new to me about the system looking
for certain flags inside the file if the file name does not have 
the .sh ending.   Go back and check that out, but the this, assume
you have to have .sh and execute permission.

You do not have to have a start/stop/restart check in the script if
the script will always just run regardless of parameter.   But, 
what the system does is call the script with a parameter of 'start'
at boot time and a parameter of 'stop' at shutdown time.

But for the sake of the primative test, those can be omitted.

Let's say you call the scriptfile: 'rctest.sh'
Put something like: 

#!/bin/sh
 echo "running rctest.sh, got this far"

# Add any any other stuff you want to test

echo "running rctest.sh, finished"


Now, if the bare skeleton works, then start adding more parts
to it until you get to where everything works.   Add more echo-s
if they are useful.

You could also look up how to get your messages written to a log
file.

////jerry
 
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"


More information about the freebsd-questions mailing list