Re: mysql rc script failure - correction: most installed rc scripts not running manually

2008-10-02 Thread Jonathan McKeown
On Thursday 02 October 2008 01:59:18 Da Rock wrote:
 On Wed, 2008-10-01 at 12:53 +0200, Erik Trulsson wrote:
  On Wed, Oct 01, 2008 at 08:39:47PM +1000, Da Rock wrote:
  
   So are you saying I can't start a script manually without enabling it
   in rc.conf? I was not under that impression... I thought it could be
   started manually for testing before setting it for automatic startup-
   based on my reading in the handbook and man pages.
 
  Yes, you can.  Use forcestart/forcestop instead of start/stop when
  running the rc script if you do not have it enabled in rc.conf.  This is
  documented in rc(8) (and is very easily overlooked if you don't know what
  you are looking for.)

 Well thank you both for that piece of information, I had overlooked
 that. I did end up using it that way, but I was still unaware that it
 was mandatory.

The problem with forcestart is that it ignores any errors that may occur. The 
better option for a manual start is onestart, which simply bypasses the test 
for the option being enabled but still fails on any other error (missing 
dependencies, startup problems etc).

Jonathan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: mysql rc script failure - correction: most installed rc scripts not running manually

2008-10-02 Thread Da Rock

On Thu, 2008-10-02 at 09:18 +0200, Jonathan McKeown wrote:
 On Thursday 02 October 2008 01:59:18 Da Rock wrote:
  On Wed, 2008-10-01 at 12:53 +0200, Erik Trulsson wrote:
   On Wed, Oct 01, 2008 at 08:39:47PM +1000, Da Rock wrote:
   
So are you saying I can't start a script manually without enabling it
in rc.conf? I was not under that impression... I thought it could be
started manually for testing before setting it for automatic startup-
based on my reading in the handbook and man pages.
  
   Yes, you can.  Use forcestart/forcestop instead of start/stop when
   running the rc script if you do not have it enabled in rc.conf.  This is
   documented in rc(8) (and is very easily overlooked if you don't know what
   you are looking for.)
 
  Well thank you both for that piece of information, I had overlooked
  that. I did end up using it that way, but I was still unaware that it
  was mandatory.
 
 The problem with forcestart is that it ignores any errors that may occur. The 
 better option for a manual start is onestart, which simply bypasses the test 
 for the option being enabled but still fails on any other error (missing 
 dependencies, startup problems etc).
 
 Jonathan

Well that might be more useful (and best practice)...

Cheers for the heads up guys

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: mysql rc script failure - correction: most installed rc scripts not running manually

2008-10-01 Thread Da Rock

On Wed, 2008-10-01 at 15:40 +1000, Da Rock wrote:
 Has anyone else had trouble with starting mysql server with the rc
 script?
 
 I've only just installed from ports (as a dependency, mind) and
 technically it should just start when you run the rc script - it sets up
 the db dirs and stuff so it can just run. But I can't get it to do the
 setup stuff automatically, and so the script fails. I've done the setup
 manually before so its no real biggy, but I imagine others would be more
 than a little frustrated.
 
 Anyone else have this trouble? I just realised I had to do this last
 time too...
 
 For reference: I'm starting the script manually for testing at this
 point (if that makes a difference- which I believe it shouldn't).

Manually running port installed rc scripts is not working manually. I'm
trying mysql, courier-imap, and I've tried isc-dhcp in the past. None of
these will work when run manually- even on different machines and bsd
versions (all 6.x).

Is it just me?

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: mysql rc script failure - correction: most installed rc scripts not running manually

2008-10-01 Thread Boris Samorodov
Da Rock [EMAIL PROTECTED] writes:
 On Wed, 2008-10-01 at 15:40 +1000, Da Rock wrote:

 Has anyone else had trouble with starting mysql server with the rc
 script?
 
 I've only just installed from ports (as a dependency, mind) and
 technically it should just start when you run the rc script - it sets up
 the db dirs and stuff so it can just run. But I can't get it to do the
 setup stuff automatically, and so the script fails. I've done the setup
 manually before so its no real biggy, but I imagine others would be more
 than a little frustrated.
 
 Anyone else have this trouble? I just realised I had to do this last
 time too...
 
 For reference: I'm starting the script manually for testing at this
 point (if that makes a difference- which I believe it shouldn't).

 Manually running port installed rc scripts is not working manually. I'm
 trying mysql, courier-imap, and I've tried isc-dhcp in the past. None of
 these will work when run manually- even on different machines and bsd
 versions (all 6.x).

 Is it just me?

Sorry for may be a dumb question: did you define an
daemon_enable=YES at /etc/rc.conf[.local]? For more info
you may look at the script you are trying to start.


WBR
-- 
Boris Samorodov (bsam)
Research Engineer, http://www.ipt.ru Telephone  Internet SP
FreeBSD committer, http://www.FreeBSD.org The Power To Serve
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: mysql rc script failure - correction: most installed rc scripts not running manually

2008-10-01 Thread Da Rock

On Wed, 2008-10-01 at 12:57 +0400, Boris Samorodov wrote:
 Da Rock [EMAIL PROTECTED] writes:
  On Wed, 2008-10-01 at 15:40 +1000, Da Rock wrote:
 
  Has anyone else had trouble with starting mysql server with the rc
  script?
  
  I've only just installed from ports (as a dependency, mind) and
  technically it should just start when you run the rc script - it sets up
  the db dirs and stuff so it can just run. But I can't get it to do the
  setup stuff automatically, and so the script fails. I've done the setup
  manually before so its no real biggy, but I imagine others would be more
  than a little frustrated.
  
  Anyone else have this trouble? I just realised I had to do this last
  time too...
  
  For reference: I'm starting the script manually for testing at this
  point (if that makes a difference- which I believe it shouldn't).
 
  Manually running port installed rc scripts is not working manually. I'm
  trying mysql, courier-imap, and I've tried isc-dhcp in the past. None of
  these will work when run manually- even on different machines and bsd
  versions (all 6.x).
 
  Is it just me?
 
 Sorry for may be a dumb question: did you define an
 daemon_enable=YES at /etc/rc.conf[.local]? For more info
 you may look at the script you are trying to start.

So are you saying I can't start a script manually without enabling it in
rc.conf? I was not under that impression... I thought it could be
started manually for testing before setting it for automatic startup-
based on my reading in the handbook and man pages.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: mysql rc script failure - correction: most installed rc scripts not running manually

2008-10-01 Thread Erik Trulsson
On Wed, Oct 01, 2008 at 08:39:47PM +1000, Da Rock wrote:
 
 On Wed, 2008-10-01 at 12:57 +0400, Boris Samorodov wrote:
  Da Rock [EMAIL PROTECTED] writes:
   On Wed, 2008-10-01 at 15:40 +1000, Da Rock wrote:
  
   Has anyone else had trouble with starting mysql server with the rc
   script?
   
   I've only just installed from ports (as a dependency, mind) and
   technically it should just start when you run the rc script - it sets up
   the db dirs and stuff so it can just run. But I can't get it to do the
   setup stuff automatically, and so the script fails. I've done the setup
   manually before so its no real biggy, but I imagine others would be more
   than a little frustrated.
   
   Anyone else have this trouble? I just realised I had to do this last
   time too...
   
   For reference: I'm starting the script manually for testing at this
   point (if that makes a difference- which I believe it shouldn't).
  
   Manually running port installed rc scripts is not working manually. I'm
   trying mysql, courier-imap, and I've tried isc-dhcp in the past. None of
   these will work when run manually- even on different machines and bsd
   versions (all 6.x).
  
   Is it just me?
  
  Sorry for may be a dumb question: did you define an
  daemon_enable=YES at /etc/rc.conf[.local]? For more info
  you may look at the script you are trying to start.
 
 So are you saying I can't start a script manually without enabling it in
 rc.conf? I was not under that impression... I thought it could be
 started manually for testing before setting it for automatic startup-
 based on my reading in the handbook and man pages.

Yes, you can.  Use forcestart/forcestop instead of start/stop when running
the rc script if you do not have it enabled in rc.conf.  This is documented
in rc(8) (and is very easily overlooked if you don't know what you are
looking for.)



-- 
Insert your favourite quote here.
Erik Trulsson
[EMAIL PROTECTED]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: mysql rc script failure - correction: most installed rc scripts not running manually

2008-10-01 Thread Valentin Bud
On Wed, Oct 1, 2008 at 12:39 PM, Da Rock [EMAIL PROTECTED]wrote:


 On Wed, 2008-10-01 at 12:57 +0400, Boris Samorodov wrote:
  Da Rock [EMAIL PROTECTED] writes:
   On Wed, 2008-10-01 at 15:40 +1000, Da Rock wrote:
 
   Has anyone else had trouble with starting mysql server with the rc
   script?
  
   I've only just installed from ports (as a dependency, mind) and
   technically it should just start when you run the rc script - it sets
 up
   the db dirs and stuff so it can just run. But I can't get it to do the
   setup stuff automatically, and so the script fails. I've done the
 setup
   manually before so its no real biggy, but I imagine others would be
 more
   than a little frustrated.
  
   Anyone else have this trouble? I just realised I had to do this last
   time too...
  
   For reference: I'm starting the script manually for testing at this
   point (if that makes a difference- which I believe it shouldn't).
  
   Manually running port installed rc scripts is not working manually. I'm
   trying mysql, courier-imap, and I've tried isc-dhcp in the past. None
 of
   these will work when run manually- even on different machines and bsd
   versions (all 6.x).
  
   Is it just me?
 
  Sorry for may be a dumb question: did you define an
  daemon_enable=YES at /etc/rc.conf[.local]? For more info
  you may look at the script you are trying to start.

 So are you saying I can't start a script manually without enabling it in
 rc.conf? I was not under that impression... I thought it could be
 started manually for testing before setting it for automatic startup-
 based on my reading in the handbook and man pages.


Yes you can without put it in /etc/rc.conf. Use the force word.

# /usr/local/etc/rc.d/mysql-server forcestart

all the best,
v


 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to 
 [EMAIL PROTECTED]

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: mysql rc script failure - correction: most installed rc scripts not running manually

2008-10-01 Thread Da Rock

On Wed, 2008-10-01 at 12:53 +0200, Erik Trulsson wrote:
 On Wed, Oct 01, 2008 at 08:39:47PM +1000, Da Rock wrote:
  
  On Wed, 2008-10-01 at 12:57 +0400, Boris Samorodov wrote:
   Da Rock [EMAIL PROTECTED] writes:
On Wed, 2008-10-01 at 15:40 +1000, Da Rock wrote:
   
Has anyone else had trouble with starting mysql server with the rc
script?

I've only just installed from ports (as a dependency, mind) and
technically it should just start when you run the rc script - it sets 
up
the db dirs and stuff so it can just run. But I can't get it to do the
setup stuff automatically, and so the script fails. I've done the setup
manually before so its no real biggy, but I imagine others would be 
more
than a little frustrated.

Anyone else have this trouble? I just realised I had to do this last
time too...

For reference: I'm starting the script manually for testing at this
point (if that makes a difference- which I believe it shouldn't).
   
Manually running port installed rc scripts is not working manually. I'm
trying mysql, courier-imap, and I've tried isc-dhcp in the past. None of
these will work when run manually- even on different machines and bsd
versions (all 6.x).
   
Is it just me?
   
   Sorry for may be a dumb question: did you define an
   daemon_enable=YES at /etc/rc.conf[.local]? For more info
   you may look at the script you are trying to start.
  
  So are you saying I can't start a script manually without enabling it in
  rc.conf? I was not under that impression... I thought it could be
  started manually for testing before setting it for automatic startup-
  based on my reading in the handbook and man pages.
 
 Yes, you can.  Use forcestart/forcestop instead of start/stop when running
 the rc script if you do not have it enabled in rc.conf.  This is documented
 in rc(8) (and is very easily overlooked if you don't know what you are
 looking for.)

Well thank you both for that piece of information, I had overlooked
that. I did end up using it that way, but I was still unaware that it
was mandatory.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: rc scripts

2008-06-30 Thread David Allen
On Fri, Jun 27, 2008 at 3:01 PM, Derek Ragona
[EMAIL PROTECTED] wrote:

 At 04:11 PM 6/27/2008, David Allen wrote:

 I need to an '-s' flag to the execution of openntpd's rc script:
 The problems I'm having are multiple.  First, the program doesn't offer
 any logging, and running it with the do not daemonize switch with

# /usr/local/sbin/ntpd -d 21  logfile

 yields no output.

 Add:
 set -x

 at the top of the script and run the output to a file as you were doing.  I 
 would add a path to the logfile though and don't worry about the daemon like:

 /usr/local/sbin/ntpd start 21 /tmp/logfile

 Then you can kill it off and see what the startup looked like in the logfile.

Using set -x didn't occur to me, but from a brief look at the output,
it seemed to pick up (which, I guess, it shouldn't) my
openntpd_flags=-s in /etc/rc.conf.  But even then, the logfile was
populated with nothing more than Starting openntpd, so I'm back to
where I started.

I guess I'll be filing this in my WTF notes, and call it a day.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: rc scripts

2008-06-30 Thread David Allen
On 6/27/08, Paul Schmehl [EMAIL PROTECTED] wrote:
 --On Friday, June 27, 2008 14:11:55 -0700 David Allen
 [EMAIL PROTECTED] wrote:

 I need to an '-s' flag to the execution of openntpd's rc script:

# PROVIDE: openntpd
# REQUIRE: DAEMON
# BEFORE:  LOGIN
# KEYWORD: nojail

. /etc/rc.subr

name=openntpd
rcvar=`set_rcvar`
command=/usr/local/sbin/ntpd
required_files=/usr/local/etc/ntpd.conf
openntpd_enable=${openntpd_enable:-NO}
load_rc_config $name
run_rc_command $1

 The problems I'm having are multiple.  First, the program doesn't offer
 any logging, and running it with the do not daemonize switch with

# /usr/local/sbin/ntpd -d 21  logfile

 yields no output.

 Then, I'm not sure I understand everything I'm reading in rc.subr(8), but
 from trial error, I've discovered that modifying the script's command
 variable doesn't work, nor does adding the usual scriptname_flags
 directive to /etc/rc.conf.

 Scriptname_flags doesn't work because the port maintainer didn't write the
 startup script so that it parses rc.conf for variables.  You can edit the
 script like this:

 command_args=-s

 When rc.subr runs scripts, it runs them like this:

 ${command} ${command_args} ${command_flags}

 Or you can add this to the startup script and then use flags in rc.conf:
 load_rc_config openntpd

 openntpd_flags=${openntpd_flags:-}

 (In that order.)

 Then place openntpd_flags=-s in rc.conf.

 Just remember that every time the port is updated, your changes will be
 overwritten, so you'll need to make a backup or leave a note to yourself
 somewhere so you remember to alter the new script.

Thanks for that explanation.

I've since discovered that the sync on start doesn't really work (at
least in the same time frame that ntpd does) anyway, so I'll have to
resort to running 'ntpd -gq' at system startup, and then run OpenBSD's
ntpd daemon after the fact.

At least I've something about the rc system.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


rc scripts

2008-06-27 Thread David Allen
I need to an '-s' flag to the execution of openntpd's rc script:

   # PROVIDE: openntpd
   # REQUIRE: DAEMON
   # BEFORE:  LOGIN
   # KEYWORD: nojail

   . /etc/rc.subr

   name=openntpd
   rcvar=`set_rcvar`
   command=/usr/local/sbin/ntpd
   required_files=/usr/local/etc/ntpd.conf
   openntpd_enable=${openntpd_enable:-NO}
   load_rc_config $name
   run_rc_command $1

The problems I'm having are multiple.  First, the program doesn't offer
any logging, and running it with the do not daemonize switch with

   # /usr/local/sbin/ntpd -d 21  logfile

yields no output.

Then, I'm not sure I understand everything I'm reading in rc.subr(8), but
from trial error, I've discovered that modifying the script's command
variable doesn't work, nor does adding the usual scriptname_flags
directive to /etc/rc.conf.

Comments, questions and complaints all welcomed.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: rc scripts

2008-06-27 Thread Derek Ragona

At 04:11 PM 6/27/2008, David Allen wrote:

I need to an '-s' flag to the execution of openntpd's rc script:

   # PROVIDE: openntpd
   # REQUIRE: DAEMON
   # BEFORE:  LOGIN
   # KEYWORD: nojail

   . /etc/rc.subr

   name=openntpd
   rcvar=`set_rcvar`
   command=/usr/local/sbin/ntpd
   required_files=/usr/local/etc/ntpd.conf
   openntpd_enable=${openntpd_enable:-NO}
   load_rc_config $name
   run_rc_command $1

The problems I'm having are multiple.  First, the program doesn't offer
any logging, and running it with the do not daemonize switch with

   # /usr/local/sbin/ntpd -d 21  logfile

yields no output.

Then, I'm not sure I understand everything I'm reading in rc.subr(8), but
from trial error, I've discovered that modifying the script's command
variable doesn't work, nor does adding the usual scriptname_flags
directive to /etc/rc.conf.

Comments, questions and complaints all welcomed.


Add:
set -x

at the top of the script and run the output to a file as you were doing.  I 
would add a path to the logfile though and don't worry about the daemon like:


/usr/local/sbin/ntpd start 21 /tmp/logfile

Then you can kill it off and see what the startup looked like in the logfile.

-Derek


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: rc scripts

2008-06-27 Thread Paul Schmehl
--On Friday, June 27, 2008 14:11:55 -0700 David Allen 
[EMAIL PROTECTED] wrote:



I need to an '-s' flag to the execution of openntpd's rc script:

   # PROVIDE: openntpd
   # REQUIRE: DAEMON
   # BEFORE:  LOGIN
   # KEYWORD: nojail

   . /etc/rc.subr

   name=openntpd
   rcvar=`set_rcvar`
   command=/usr/local/sbin/ntpd
   required_files=/usr/local/etc/ntpd.conf
   openntpd_enable=${openntpd_enable:-NO}
   load_rc_config $name
   run_rc_command $1

The problems I'm having are multiple.  First, the program doesn't offer
any logging, and running it with the do not daemonize switch with

   # /usr/local/sbin/ntpd -d 21  logfile

yields no output.

Then, I'm not sure I understand everything I'm reading in rc.subr(8), but
from trial error, I've discovered that modifying the script's command
variable doesn't work, nor does adding the usual scriptname_flags
directive to /etc/rc.conf.



Scriptname_flags doesn't work because the port maintainer didn't write the 
startup script so that it parses rc.conf for variables.  You can edit the 
script like this:


command_args=-s

When rc.subr runs scripts, it runs them like this:

${command} ${command_args} ${command_flags}

Or you can add this to the startup script and then use flags in rc.conf:
load_rc_config openntpd

openntpd_flags=${openntpd_flags:-}

(In that order.)

Then place openntpd_flags=-s in rc.conf.

Just remember that every time the port is updated, your changes will be 
overwritten, so you'll need to make a backup or leave a note to yourself 
somewhere so you remember to alter the new script.


--
Paul Schmehl
As if it wasn't already obvious,
my opinions are my own and not
those of my employer.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Question about rc-scripts

2007-10-09 Thread Mel
On Tuesday 09 October 2007 03:07:22 Stephen Allen wrote:
 Hi Derek,

  Not all scripts create a pid file is the simple answer.

 I didn't see how the isc-dhcpd script or dovecot created a pid, so I
 assumed it was something that rc.subr took care of.

  Your script should create the pid file on start, remove it on stop, and
  simply cat that file on a status.  If you want help with your script,
  post it, and I'm sure one of us will give you a hand.

 Again, I thought the rc.subr functions took care of all that for you
 (unless you wanted something special from those commands).

Creation of pid files isn't supported in /etc/rc.subr. It's a burdon of the 
application to do this for you, however, if your application doesn't do this, 
you can possibly use daemon(8) for the start_cmd, to create one for you.

This is however - quite up to the application. Some applications daemonize 
themselves by forking a child and detach the parent, in which case the pid 
file created by the daemon(8) command is useless, because it records the 
detached parent, not the running child.

On the other hand, pid files are a convenience, not a requirement for rc 
scripts. If no pidfile variable is defined, it will simply `killall $name`.

 I've posted the script (changed quite a lot from vendor supplied) at:
 http://www.pastebin.ca/730238

I'd make the start_cmd as follows:
start_cmd=${name}_start

dbgw_start()
{
echo Starting ${name}
/usr/bin/nice -5 /usr/sbin/daemon -p ${pidfile} ${command} \
${dbgw_flags} ${command_args}
}


-- 
Mel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Question about rc-scripts

2007-10-09 Thread sdafreebsduk

Hi Philip,

Most binaries i.e. httpd, memcached, mysqld, etc... provide a config 
file or cli option to provide the path to a pid file.


Like you say - I can't find anything in rc.subr that would create a pid. 
 So, I looked in /etc/rc.d/ntpd (for example), and I still can't find 
in there where it might create a pid.


Your particular problem is that run_rc_command actually exits so that 
the script exits with the correct return code generally that of what 
the application in question returns from trying to start or stop.


Inless you have a reason, If you're running a daemon, you shouldn't need 
to background the command.


It /is/ a daemon


Also, rather then an echo try adding -x to the shebang line.


Yeah, I did that whilst I was re-arranging it.  I think my problem is, I 
don't understand properly what creates the pids for the standard scripts 
(like nptd), so I can't look at it to see how it's done.


Many thanks,
Steve
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Question about rc-scripts

2007-10-09 Thread Chuck Swiger

On Oct 9, 2007, at 5:16 PM, [EMAIL PROTECTED] wrote:
Most binaries i.e. httpd, memcached, mysqld, etc... provide a  
config file or cli option to provide the path to a pid file.


Like you say - I can't find anything in rc.subr that would create a  
pid.  So, I looked in /etc/rc.d/ntpd (for example), and I still  
can't find in there where it might create a pid.


In the case of ntpd, the default arguments look like this:

  /usr/sbin/ntpd -p /var/run/ntpd.pid ...

...so the ntpd process creates the pidfile.

--
-Chuck

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Question about rc-scripts

2007-10-08 Thread Stephen Allen

Under normal circumstance, should the /etc/rc.subr functions handle the
creation of the pid at service start?

The basic vendor-provided script (which I've had to adapt somewhat to
suit this installation) runs echo $!  ${dbgw_pidfile} as the last
line of the script.  When you do a 'status' command though, it blanks
out the contents of the pid.  That echo line isn't present in any of the
standard scripts - hence my initial question.

Apart from variable assignments, the script defines 'start_cmd' (which I
assume is used as the start command by rc.subr).  Strange that I
couldn't find any reference to start_cmd in /etc/rc.subr though.

So, my question is, why isn't the pidfile being automagically created?

Many thanks,
Steve

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Question about rc-scripts

2007-10-08 Thread Derek Ragona

At 05:45 PM 10/8/2007, Stephen Allen wrote:

Under normal circumstance, should the /etc/rc.subr functions handle the
creation of the pid at service start?

The basic vendor-provided script (which I've had to adapt somewhat to
suit this installation) runs echo $!  ${dbgw_pidfile} as the last
line of the script.  When you do a 'status' command though, it blanks
out the contents of the pid.  That echo line isn't present in any of the
standard scripts - hence my initial question.

Apart from variable assignments, the script defines 'start_cmd' (which I
assume is used as the start command by rc.subr).  Strange that I
couldn't find any reference to start_cmd in /etc/rc.subr though.

So, my question is, why isn't the pidfile being automagically created?

Many thanks,
Steve


Not all scripts create a pid file is the simple answer.

Your script should create the pid file on start, remove it on stop, and 
simply cat that file on a status.  If you want help with your script, post 
it, and I'm sure one of us will give you a hand.


-Derek

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Question about rc-scripts

2007-10-08 Thread Stephen Allen

Hi Derek,


Not all scripts create a pid file is the simple answer.


I didn't see how the isc-dhcpd script or dovecot created a pid, so I
assumed it was something that rc.subr took care of.

Your script should create the pid file on start, remove it on stop, and 
simply cat that file on a status.  If you want help with your script, 
post it, and I'm sure one of us will give you a hand.


Again, I thought the rc.subr functions took care of all that for you
(unless you wanted something special from those commands).

I've posted the script (changed quite a lot from vendor supplied) at:
http://www.pastebin.ca/730238

If you (or anyone) were to suggest changes, I would very much appreciate
the reasons why, so I can learn.

Many thanks,
Steve

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Question about rc-scripts

2007-10-08 Thread Philip M. Gollucci



Again, I thought the rc.subr functions took care of all that for you
(unless you wanted something special from those commands).
  

In general, they do
see /etc/rc.subr:
   check_pidfile(),
   wait_for_pids(),

Most binaries i.e. httpd, memcached, mysqld, etc... provide a config 
file or cli option to provide the path to a pid file.
If you look in the ports tree a lot of the patches are putting this in 
the appropriate location: /var/run


The rc.subr then just uses them.

In general this system is very flexible.  It breaks down if you wanted 
to run say 2 distinct memcached daemons on different ports with 
different pid files

via the /usr/local/etc/rc.d/script


I've posted the script (changed quite a lot from vendor supplied) at:
http://www.pastebin.ca/730238
  


Your particular problem is that run_rc_command actually exists so that 
the script exists with the correct return code generally that of what 
the application

in question returns from trying to start or stop.

Inless you have a reason, If you're running a daemon, you shouldn't need 
to background the command.


Also, rather then an echo try adding -x to the shebang line.



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Question about rc-scripts

2007-10-08 Thread Philip M. Gollucci

Philip M. Gollucci wrote:

Your particular problem is that run_rc_command actually exists so that
the script exists with the correct return code generally that of what
the application
in question returns from trying to start or stop.
  

s/exists/exits/g in the above.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


login.conf not honored for rc scripts?

2007-02-21 Thread Josh Carroll

I've been having a problem with mysql and apache starting up properly,
and finally I think I found the issue.

I have a gallery class defined in /etc/login.conf with the limits I
want, but the rc scripts are using the default class values instead. I
put:

limits  /tmp/limits

In the /usr/local/etc/rc.d/mysql-server rc script, and I see the following:

Resource limits (current):
 cputime  infinity secs
 filesize infinity kB
 datasize24576 kB
 stacksize   24576 kB
 coredumpsize0 kB
 memoryuse   24576 kB
 memorylocked24576 kB
 maxprocesses   25
 openfiles 200
 sbsize   infinity bytes
 vmemoryuse  24576 kB

Here is the gallery login class definition from login.conf:

gallery:\
   :datasize=400M:\
   :stacksize=400M:\
   :memorylocked=400M:\
   :vmemoryuse=400M:\

And here is the mysql entry in master.passwd:

mysql:*:88:88:gallery:0:0:MySQL Daemon:/nonexistent:/sbin/nologin

I'm hoping someone can point out what I'm missing here. Before anyone
asks, yes I did run pwd_mkdb and cap_mkdb :)

Thanks!
Josh
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


[SOLVED] Re: login.conf not honored for rc scripts?

2007-02-21 Thread Josh Carroll

Ok, I should have dug into the rc scripts to begin with. For archive
sake, and so others who may stumble upon this can find a solution, I
found that for mysql, I needed the following in rc.conf:

mysql_limits=YES

And also, since the mysql rc script is hard-coded to use the login
class mysql, I had to change that name.

For apache, it's more configurable, so I was able to add the following:

apache22limits_enable=YES
apache22limits_args=-e -C www

And I just renamed the gallery class to www for clarity.

Sorry to bug the list :) I should have read the damn source to begin with.

Josh
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: using rc scripts

2006-05-13 Thread Lowell Gilbert
Atom Powers [EMAIL PROTECTED] writes:

 I wrote an rc script for cfengine, but it's not recording the pid. Am
 I doing something obviously wrong, or does rc rely on the app to
 provide the pid?

Yes.  The application has to provide the pid.  In the base system,
many do this by default, but most third party applications have to be
configured to do so.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


using rc scripts

2006-05-12 Thread Atom Powers

I wrote an rc script for cfengine, but it's not recording the pid. Am
I doing something obviously wrong, or does rc rely on the app to
provide the pid?
--
#!/bin/sh
#
# PROVIDE: cfexecd
# REQUIRE: LOGIN
# BEFORE:  securelevel
# KEYWORD: FreeBSD shutdown

. /etc/rc.subr

name=cfexecd
rcvar=`set_rcvar`

command=/usr/local/sbin/cfexecd
command_args=
pidfile=/var/run/$name.pid
#required_files=/usr/local/etc/$name.conf

# read configuration and set defaults
load_rc_config $name
: ${cfexecd_enable=NO}
: ${cfexecd_flags=}

run_rc_command $1


--
--
Perfection is just a word I use occasionally with mustard.
--Atom Powers--
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: RC scripts HOWTO

2006-03-14 Thread Andrew
http://www.netbsd.org/guide/en/chap-rc.html#chap-rc-reading may be of
some help. I believe the current system came from, or was at least
largely inspired by the NetBSD rc.d scripts.

-Andrew

On Sun, 2006-03-12 at 20:31 -0600, Eric Schuele wrote:
 Bob Goodman wrote:
  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1
  
  Guys,
  could you please direct me to some info, the detailed the better,
  on how RC and RCng scripts work in FreeBSD.
  Can't seem to find in handbook or google.
 
 man pages for rc and rcorder not provide what you are looking for either?
 
  Thanks in advance
  
  Bob
  -BEGIN PGP SIGNATURE-
  Note: This signature can be verified at https://www.hushtools.com/verify
  Version: Hush 2.5
  
  wkYEARECAAYFAkQUsd0ACgkQAQ09syE0bn5mhgCeM2CQ/Gb5GidLTeVMNXIovz2SLqsA
  nietTLt+WDO699fx4X4ig7aK//B5
  =og+9
  -END PGP SIGNATURE-
  
  
  
  
  Concerned about your privacy? Instantly send FREE secure email, no account 
  required
  http://www.hushmail.com/send?l=480
  
  Get the best prices on SSL certificates from Hushmail
  https://www.hushssl.com?l=485
  
  ___
  freebsd-questions@freebsd.org mailing list
  http://lists.freebsd.org/mailman/listinfo/freebsd-questions
  To unsubscribe, send any mail to [EMAIL PROTECTED]
  
 
 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


RC scripts HOWTO

2006-03-12 Thread Bob Goodman
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Guys,
could you please direct me to some info, the detailed the better,
on how RC and RCng scripts work in FreeBSD.
Can't seem to find in handbook or google.
Thanks in advance

Bob
-BEGIN PGP SIGNATURE-
Note: This signature can be verified at https://www.hushtools.com/verify
Version: Hush 2.5

wkYEARECAAYFAkQUsd0ACgkQAQ09syE0bn5mhgCeM2CQ/Gb5GidLTeVMNXIovz2SLqsA
nietTLt+WDO699fx4X4ig7aK//B5
=og+9
-END PGP SIGNATURE-




Concerned about your privacy? Instantly send FREE secure email, no account 
required
http://www.hushmail.com/send?l=480

Get the best prices on SSL certificates from Hushmail
https://www.hushssl.com?l=485

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: RC scripts HOWTO

2006-03-12 Thread Eric Schuele

Bob Goodman wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Guys,
could you please direct me to some info, the detailed the better,
on how RC and RCng scripts work in FreeBSD.
Can't seem to find in handbook or google.


man pages for rc and rcorder not provide what you are looking for either?


Thanks in advance

Bob
-BEGIN PGP SIGNATURE-
Note: This signature can be verified at https://www.hushtools.com/verify
Version: Hush 2.5

wkYEARECAAYFAkQUsd0ACgkQAQ09syE0bn5mhgCeM2CQ/Gb5GidLTeVMNXIovz2SLqsA
nietTLt+WDO699fx4X4ig7aK//B5
=og+9
-END PGP SIGNATURE-




Concerned about your privacy? Instantly send FREE secure email, no account 
required
http://www.hushmail.com/send?l=480

Get the best prices on SSL certificates from Hushmail
https://www.hushssl.com?l=485

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]




--
Regards,
Eric
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: RC scripts HOWTO

2006-03-12 Thread Andrew Pantyukhin
On 3/13/06, Bob Goodman [EMAIL PROTECTED] wrote:
 Guys,
 could you please direct me to some info, the detailed the better,
 on how RC and RCng scripts work in FreeBSD.
 Can't seem to find in handbook or google.

I'm afraid the only way to get comprehensive knowledge
at this time is to carefully study /etc/rc and /etc/rc.subr.

/etc/rc.d/* are nice examples.

It takes a couple of hours of reading the sources, in case
you're pretty familiar with sh.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Can't control PostgreSQL with RC scripts

2005-04-12 Thread Ed Stover
On Fri, 2005-04-08 at 10:59 +0300, Volodymyr Kostyrko wrote:
 Pat Maddox wrote:
  I installed PostgreSQL 8.0.1 from ports, and now I'd like to control
  it with the RC scripts.  I wasn't able to run initdb with the scripts,
  I had to do that manually with the regular initdb command.  Now I've
  got the db dir as /usr/local/pgsql/data, which is what it looks like
  pgsql expects, but the scripts still won't start it or stop it.  They
  don't produce any output either.  Any ideas on what to do?
 
 echo 'postgresql_enable=YES'  /etc/rc.conf
 
that Darn rcsubr again ;) 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Can't control PostgreSQL with RC scripts

2005-04-08 Thread Volodymyr Kostyrko
Pat Maddox wrote:
I installed PostgreSQL 8.0.1 from ports, and now I'd like to control
it with the RC scripts.  I wasn't able to run initdb with the scripts,
I had to do that manually with the regular initdb command.  Now I've
got the db dir as /usr/local/pgsql/data, which is what it looks like
pgsql expects, but the scripts still won't start it or stop it.  They
don't produce any output either.  Any ideas on what to do?
echo 'postgresql_enable=YES'  /etc/rc.conf
--
[WBR], Arcade. [SAT Astronomy/Think to survive!]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Can't control PostgreSQL with RC scripts

2005-04-07 Thread Pat Maddox
I installed PostgreSQL 8.0.1 from ports, and now I'd like to control
it with the RC scripts.  I wasn't able to run initdb with the scripts,
I had to do that manually with the regular initdb command.  Now I've
got the db dir as /usr/local/pgsql/data, which is what it looks like
pgsql expects, but the scripts still won't start it or stop it.  They
don't produce any output either.  Any ideas on what to do?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]