Starting Scripts

Scott Mayo sgmayo at mail.bloomfield.k12.mo.us
Mon Jun 25 17:52:56 UTC 2007


RW wrote:
> On Mon, 25 Jun 2007 10:18:30 -0500
> Scott Mayo <sgmayo at mail.bloomfield.k12.mo.us> wrote:
> 
> 
>>I have set some things to automatically start in the rc.conf like ssh 
>>and apache by doing 'sshd_enable="YES"' and 'apache22_enable="YES"'.
>>How do I start things like Zope and Cyrus?
>>
>> From the command line I can just:
>>
>>'/usr/local/cyrus/bin master &' for cyrus
>>
>>'/data/home/testuser/zope28/bin/zopectl start' for my instance of
>>zope.
>>
>>I use to add lines like this to the rc.local file in linux to get
>>them started.  I was thinking that I read that this could still be
>>done in FreeBSD, but was not the preferred way to do it.
>>
>> From looking at the scripts in '/usr/local/etc/rc.d', it looks like 
>>there are different ways.  For zope it says that I can define 
>>'zope28_enable : "YES"' in '/etc/rc.conf', '/etc/rc.conf.local' or 
>>'/etc/rc.conf/zope28', so I guess that I just add 'zope28_enable : 
>>"YES"' to my rc.conf?
>>
>>Then the imapd script in /usr/local/etc/rc.d says to:
>>
>>move imapd.sh to '/etc/rc.d/cyrus_imapd' 
> 
> 
> Don't do that - see below.
> 
> 
> 
>>and define the cyrus_imapd_*
>>in '/etc/rc.conf', '/etc/rc.conf.local' or
>>'etc/rc.conf.d/cyrus_imapd'.
>>
>>Then it shows '[ -z "$cyrus_imapd_enable" ] &&
>>cyrus_imapd_enable="NO"' and [-z "$cyrus_imapd_flags" ] &&
>>cyrus_imapd_flags="-d"'.
>>
>>Do I enter both of those commands in the '/etc/rc.conf' just as
>>shown? I assume the "NO" will be "YES".  These two lines have me a
>>bit baffled.
> 
> 
> Those lines are setting defaults, you can override them by defining
> the variables in rc.conf. *All* rc.d scripts are run startup it's just
> that those that aren't enabled don't do anything.

Ok, that makes sense.  If the default was 'enable' then it would have 
started up because the script was run, but the service was defaulted to 
'Disable'

>>I guess that I am still a bit confused on the '/etc/rc.d' and the 
>>'/usr/local/etc/rc.d' directories. There is no imapd.sh in 
>>'/usr/local/etc/rc.d', but it is only imapd.  This has had me
>>confused because in the FreeBSD handbook it talked about the scripts
>>here would all end in .sh, but none of them do.  The way that it
>>read, if there was an '.sh' file in '/usr/local/etc/rc.d' then that
>>script would be run at bootup.
>>
> 
> 
> 
> The behaviour changed, it used to be that all the local scripts ended
> in .sh and ran in alphabetical order called from the same rc.d script
> in /etc/rc.d. Nowadays local scripts can be full rcng scripts if they
> have a provide field. If you are using an up-to-date FreebSD, don't
> move anything to /etc/rc.d, leave it where it is. 
> 

Yes, this FreeBSD is up to date.  Your comment above answered this 
question for me also.  Thanks again for the info.

-- 
Scott Mayo
System Administrator
Bloomfield Schools


Duct tape is like the force, it has a light side and a dark side and it
holds the universe together.


More information about the freebsd-questions mailing list