Re: [Call for review] init(8): new feature

1999-06-16 Thread Nik Clayton
On Tue, Jun 15, 1999 at 08:59:59AM -0700, Arun Sharma wrote:
 While we're on the init topic, is there any strong feeling here about
 BSD /etc/rc* scripts Vs SysV ? 

Yes, lots.  The last round of discussion was covered in the freebsd-arch
mailing list, the archives should be enlightening.

N
-- 
 [intentional self-reference] can be easily accommodated using a blessed,
 non-self-referential dummy head-node whose own object destructor severs
 the links.
-- Tom Christiansen in 37514...@cs.colorado.edu


To Unsubscribe: send mail to majord...@freebsd.org
with unsubscribe freebsd-hackers in the body of the message



Re: [Call for review] init(8): new feature

1999-06-16 Thread Dag-Erling Smorgrav
san...@sanpei.org (MIHIRA Yoshiro) writes:
 # Yes, We modify some ports to support start,stop.

And others to no longer support it. The Apache 1.2 port used to
support it, the Apache 1.3 port doesn't. Here's a replacement:

#!/bin/sh

if [ ! -x /usr/local/sbin/apachectl ] ; then
echo apachectl not found
exit 1
fi

case $1 in
start|stop|restart)
/usr/local/sbin/apachectl $1
;;
*)
echo Usage: $(basename $0) start|stop|restart
exit 1
;;
esac

DES
-- 
Dag-Erling Smorgrav - d...@flood.ping.uio.no


To Unsubscribe: send mail to majord...@freebsd.org
with unsubscribe freebsd-hackers in the body of the message



[Call for review] init(8): new feature

1999-06-15 Thread Ruslan Ermilov
Hi, hackers!

While the -core is busy to review/approve this patch,
I would like to know your opinion.  What do you think
of it?


Thanks,
-- 
Ruslan Ermilov  Sysadmin and DBA of the
r...@ucb.crimea.ua  United Commercial Bank,
r...@freebsd.orgFreeBSD committer,
+380.652.247.647Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age
---BeginMessage---
Hi!

We have a lot of PRs (5451, 9066, 10035) complaining the lack
of running /etc/rc.shutdown from shutdown(8)/reboot(8).

In fact, there are two ways to cleanly (with /etc/rc.shutdown)
reboot the system:

- send init(8) SIGINT signal;
- run shutdown(8) without ``-r'' and ``-h'' switches, so it
  will send init(8) SIGINT signal.

On the other hand, there is no easy (single-step) way to run
/etc/rc.shutdown and then halt plus optionally power-off the
system.

The patch below (mostly from PR#5451) removes this limitation
by adding two new features to init(8):

- when init(8) receives SIGUSR1, it will act like in SIGINT
  case, but will call reboot(RB_HALT);

- when init(8) receives SIGUSR2, it will act like in SIGINT
  case, but will call reboot(RB_HALT|RB_POWEROFF).

Also, when compiled with -DCOMPAT_SYSV_INIT, it is now possible
to emulate SysV's init(8) behaviour.

I have tested it on my 3.2-STABLE, and it works like a charm.
Very handy!!!

Could you please review it?

Thanks,
-- 
Ruslan Ermilov  Sysadmin and DBA of the
r...@ucb.crimea.ua  United Commercial Bank
+380.652.247.647Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age
Index: Makefile
===
RCS file: /usr/FreeBSD-CVS/src/sbin/init/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- Makefile1998/01/20 10:39:56 1.15
+++ Makefile1999/06/11 20:14:19
@@ -6,6 +6,7 @@
 BINMODE=500
 INSTALLFLAGS=-fschg
 CFLAGS+=-DDEBUGSHELL -DSECURE -DLOGIN_CAP
+CFLAGS+=-DCOMPAT_SYSV_INIT
 
 .if exists(${.CURDIR}/../../secure)  !defined(NOCRYPT)  !defined(NOSECURE)
 DISTRIBUTION=des
Index: init.c
===
RCS file: /usr/FreeBSD-CVS/src/sbin/init/init.c,v
retrieving revision 1.31
diff -u -r1.31 init.c
--- init.c  1998/07/22 05:45:11 1.31
+++ init.c  1999/06/11 20:28:59
@@ -132,6 +132,7 @@
 #define TRUE   1
 
 int Reboot = FALSE;
+int howto = RB_AUTOBOOT;
 
 int devfs;
 
@@ -203,9 +204,44 @@
errx(1, %s, strerror(EPERM));
 
/* System V users like to reexec init. */
-   if (getpid() != 1)
-   errx(1, already running);
-
+   if (getpid() != 1) {
+#ifdef COMPAT_SYSV_INIT
+   /* So give them what they want */
+   if (argc  1) {
+   if (strlen(argv[1]) == 1) {
+   register char state = *argv[1];
+   register int sig;
+
+   switch (state) {
+   case '0': /* halt + poweroff */
+   sig = SIGUSR2;
+   break;
+   case '1': /* single user */
+   case 's':
+   sig = SIGTERM;
+   break;
+   case '6': /* reboot */
+   sig = SIGINT;
+   break;
+   case 'q': /* re-read /etc/ttys */
+   sig = SIGHUP;
+   break;
+   case 'c': /* block further logins */
+   sig = SIGTSTP;
+   break;
+   default:
+   goto usage;
+   }
+   kill(1, sig);
+   _exit(0);
+   } else
+usage:
+   errx(1, invalid level ``%s''\n
+   usage: init [016cqs], argv[1]);
+   } else
+#endif
+   errx(1, already running);
+   }
/*
 * Note that this does NOT open a file...
 * Does 'init' deserve its own facility number?
@@ -259,11 +295,13 @@
handle(badsys, SIGSYS, 0);
handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV,
   SIGBUS, SIGXCPU, SIGXFSZ, 0);
-   handle(transition_handler, SIGHUP, SIGINT, SIGTERM, SIGTSTP, 0);
+   handle(transition_handler, SIGHUP, SIGINT, SIGTERM, SIGTSTP,
+   

Re: [Call for review] init(8): new feature

1999-06-15 Thread Arun Sharma

While we're on the init topic, is there any strong feeling here about
BSD /etc/rc* scripts Vs SysV ? The nice thing about SysV initscripts
is the ability to start and stop any service that I like.

-Arun


To Unsubscribe: send mail to majord...@freebsd.org
with unsubscribe freebsd-hackers in the body of the message



Re: [Call for review] init(8): new feature

1999-06-15 Thread Bill Fumerola
On Tue, 15 Jun 1999, Ruslan Ermilov wrote:

 While the -core is busy to review/approve this patch,
 I would like to know your opinion.  What do you think
 of it?

The sysv init should probably be off by default.

- bill fumerola - bi...@chc-chimes.com - BF1560 - computer horizons corp -
- ph:(800) 252-2421 - bfume...@computerhorizons.com - bi...@freebsd.org  -





To Unsubscribe: send mail to majord...@freebsd.org
with unsubscribe freebsd-hackers in the body of the message



Re: [Call for review] init(8): new feature

1999-06-15 Thread Ruslan Ermilov
On Tue, Jun 15, 1999 at 07:51:54AM -0400, Bill Fumerola wrote:
 On Tue, 15 Jun 1999, Ruslan Ermilov wrote:
 
  While the -core is busy to review/approve this patch,
  I would like to know your opinion.  What do you think
  of it?
 
 The sysv init should probably be off by default.
 
Sure, I turned it on only for test purposes, in case
someone wants to try it out.

-- 
Ruslan Ermilov  Sysadmin and DBA of the
r...@ucb.crimea.ua  United Commercial Bank,
r...@freebsd.orgFreeBSD committer,
+380.652.247.647Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age


To Unsubscribe: send mail to majord...@freebsd.org
with unsubscribe freebsd-hackers in the body of the message



Re: [Call for review] init(8): new feature

1999-06-15 Thread Mark Newton
Arun Sharma wrote:

  While we're on the init topic, is there any strong feeling here about
  BSD /etc/rc* scripts Vs SysV ? The nice thing about SysV initscripts
  is the ability to start and stop any service that I like.

That's fine -- there are lots of ways to start and stop any service you
like without involving SysV init.

   - mark


Mark Newton   Email:  new...@internode.com.au (W)
Network Engineer  Email:  new...@atdot.dotat.org  (H)
Internode Systems Pty Ltd Desk:   +61-8-82232999
Network Man - Anagram of Mark Newton  Mobile: +61-416-202-223


To Unsubscribe: send mail to majord...@freebsd.org
with unsubscribe freebsd-hackers in the body of the message



Re: [Call for review] init(8): new feature

1999-06-15 Thread Arun Sharma
Mark Newton new...@internode.com.au writes:

 Arun Sharma wrote:
 
   While we're on the init topic, is there any strong feeling here about
   BSD /etc/rc* scripts Vs SysV ? The nice thing about SysV initscripts
   is the ability to start and stop any service that I like.
 
 That's fine -- there are lots of ways to start and stop any service you
 like without involving SysV init.

Like sending a signal to the process providing the service ? The
problem with that approach is, the signal you send and the clean up
you do is non-standard for each service and having a standard
interface:

/etc/rc.d/service stop|start|restart

makes it standard. 

-Arun


To Unsubscribe: send mail to majord...@freebsd.org
with unsubscribe freebsd-hackers in the body of the message



Re: [Call for review] init(8): new feature

1999-06-15 Thread Mark Newton
Arun Sharma wrote:

  Mark Newton new...@internode.com.au writes:
   Arun Sharma wrote:
   
 While we're on the init topic, is there any strong feeling here about
 BSD /etc/rc* scripts Vs SysV ? The nice thing about SysV initscripts
 is the ability to start and stop any service that I like.
   That's fine -- there are lots of ways to start and stop any service you
   like without involving SysV init.
  
  Like sending a signal to the process providing the service ? The
  problem with that approach is, the signal you send and the clean up
  you do is non-standard for each service and having a standard
  interface:
 
There are lots of ways to start and stop any service you like without
relying on sending a signal to a process and without involving SysV init.

This topic has been canvassed so many times by so many people that I can
only suggest that you run off to the archives and read about it there.

- mark


Mark Newton   Email:  new...@internode.com.au (W)
Network Engineer  Email:  new...@atdot.dotat.org  (H)
Internode Systems Pty Ltd Desk:   +61-8-82232999
Network Man - Anagram of Mark Newton  Mobile: +61-416-202-223


To Unsubscribe: send mail to majord...@freebsd.org
with unsubscribe freebsd-hackers in the body of the message



Re: [Call for review] init(8): new feature

1999-06-15 Thread Wayne Cuddy
They SysV way is more elegant and less error prone for bad typist.  Graphical
tools can be used to interface with these quite easily.  It also also easy to
automate installations via installation mechanisms.  I don't think I agree
that it is a bad idea because it is associated with SysV... 

On 15 Jun 1999, Arun Sharma wrote:

 Date: 15 Jun 1999 19:54:51 -0700
 From: Arun Sharma adsha...@home.com
 To: Mark Newton new...@internode.com.au
 Cc: hack...@freebsd.org
 Subject: Re: [Call for review] init(8): new feature
 
 Mark Newton new...@internode.com.au writes:
 
  Arun Sharma wrote:
  
While we're on the init topic, is there any strong feeling here about
BSD /etc/rc* scripts Vs SysV ? The nice thing about SysV initscripts
is the ability to start and stop any service that I like.
  
  That's fine -- there are lots of ways to start and stop any service you
  like without involving SysV init.
 
 Like sending a signal to the process providing the service ? The
 problem with that approach is, the signal you send and the clean up
 you do is non-standard for each service and having a standard
 interface:
 
 /etc/rc.d/service stop|start|restart
 
 makes it standard. 
 
   -Arun
 
 
 To Unsubscribe: send mail to majord...@freebsd.org
 with unsubscribe freebsd-hackers in the body of the message
 




To Unsubscribe: send mail to majord...@freebsd.org
with unsubscribe freebsd-hackers in the body of the message



Re: [Call for review] init(8): new feature

1999-06-15 Thread Mark Newton
Wayne Cuddy wrote:

  They SysV way is more elegant and less error prone for bad typist. 

... and has absolutely no way of encoding interdependencies between
services (or any concept of a service at all, other than as
after-the-fact hacks).  What happens to your NFS services when 
you do /etc/init.d/inetsvc stop; /etc/init.d/inetsvc start on
a Sun?  What *should* happen on a notebook computer when you start
it without its pccard ethernet device plugged in?  Should certain
network services not be started at all, or should they be delayed
until after PPP comes up?  Isn't that a question that can only be
answered by the individual service?  (like, DHCP wouldn't need to
start at all when PPP comes up, but your web server might need to
be restarted to listen to a new IP address).

  Graphical tools can be used to interface with these quite easily. 

... also true for any other well-designed interface.

  It also also easy to
  automate installations via installation mechanisms. 

Also true for any other well-designed interface.  SysV's mechanism
is not a well-designed interface.  Sure, it has its strengths, and
it makes certain tasks easy, but it's not the only answer that has
strengths and simplicity.

  I don't think I agree
  that it is a bad idea because it is associated with SysV... 

Neither do I;  that issue hasn't been broached in this discussion to
date.  I think it's a bad idea because it's an intrinsically bad idea.

It seems to me that every time this issue comes up people say, We
need something better than rc.local/rc.conf for boot-time configuration.
SysV has certain attributes we don't have; so let's use SysV!

It's like the politician's mantra:  SOMETHING must be done!  This
random solution counts as `something', so let's implement this 
random solution.

Let's not.  Several people have given this matter serious thought and
have come up with some excellent ideas, some of which have been
implmenented as a test platform.  Again I'd suggest that anyone 
interested in following this up consults the archives first, because
the last thing we need is to have the mailing lists rehash the same
ground *again* less than three months after the last time we rehashed
it.

[
  a note to whoever it is that's replying to this message:  you will
  no doubt delete this text in your reply, because it's stressing
  that you should CONSULT THE ARCHIVES.  have you consulted them?  if
  not, please, please, please exit your editor without saving your
  response, and consult them.  thank you for your cooperation.  normal
  service will resume shortly.
]

   - mark


Mark Newton   Email:  new...@internode.com.au (W)
Network Engineer  Email:  new...@atdot.dotat.org  (H)
Internode Systems Pty Ltd Desk:   +61-8-82232999
Network Man - Anagram of Mark Newton  Mobile: +61-416-202-223


To Unsubscribe: send mail to majord...@freebsd.org
with unsubscribe freebsd-hackers in the body of the message



Re: [Call for review] init(8): new feature

1999-06-15 Thread MIHIRA Yoshiro
adsha...@home.com wrote:
 
 Like sending a signal to the process providing the service ? The
 problem with that approach is, the signal you send and the clean up
 you do is non-standard for each service and having a standard
 interface:
 
 /etc/rc.d/service stop|start|restart
 
 makes it standard. 

  I think we need to use
/usr/local/etc/rc.d/service.sh stop|start|restart

# Yes, We modify some ports to support start,stop.

MIHIRA Sanpei Yoshiro


To Unsubscribe: send mail to majord...@freebsd.org
with unsubscribe freebsd-hackers in the body of the message



Re: [Call for review] init(8): new feature

1999-06-15 Thread Daniel O'Connor


pgpnad5Bmmg3c.pgp
Description: signed PGP message