smeets@speedy.ada.cci.de (Vincent Smeets) (05/23/91)
I am using SunOS 4.1 and I want to execute some commands just before the system is going down (shuting down Oracle and Teamwork). Is there something like a 'shutdownrc' file that will be executed wenn the shutdowntime has elapsed? I have looked at the 'shutdown' program itself, but that is no shellscript so I can't change anything. Please use mail to replay to me, because news has to catch up 2 weeks. :-{ Thanks in advance, V. Smeets
mouse@thunder.mcrcim.mcgill.edu (der Mouse) (05/25/91)
In article <138@speedy.ada.cci.de>, smeets@speedy.ada.cci.de (Vincent Smeets) writes: > I am using SunOS 4.1 and I want to execute some commands just before > the system is going down (shuting down Oracle and Teamwork). That's why shutting down sends a SIGTERM to everything. Processes that need to clean up after themselves should catch it and do whatever they feel they must. If Oracle and/or Teamwork doesn't do this, file a bug report with the vendor. If you're paying for support, *demand* a fix. > Is there something like a 'shutdownrc' file that will be executed > wenn the shutdowntime has elapsed? Not that I know of. If the commands in question execute fairly quickly, you could write a daemon which sleeps waiting for a SIGTERM and then runs whatever needs to be run. > I have looked at the 'shutdown' program itself, but that is no > shellscript so I can't change anything. Dontcha just love them binary-only distributions? (Biggest gripe I have with Sun on this point, at the moment, is add_client....) der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu
albani@cadlab.sublink.ORG (Lanfranco Albani) (05/27/91)
smeets@speedy.ada.cci.de (Vincent Smeets) writes: >I have looked at the 'shutdown' program itself, but that is no >shellscript so I can't change anything. Easy, make your own! :-) Rename /etc/shutdown as /etc/shutdown.bin, write down a script like this: --------cut-here-------- #!/bin/sh # add all the stuff you need ..... # and say goodbye... /bin/echo "Good bye, cruel world!" /etc/shutdown.bin # the REAL shutdown program --------cut-here-------- name this /etc/shutdown, check the permissions, et voila'! Bye, Lanfranco -- Lanfranco Albani - CAD.LAB s.p.a., v. Stalingrado 45, Bologna, Italia Email: (work:) albani@cadlab.sublink.org, (home:) bob@allan.sublink.org Phone: (work:) ++39 (51) 371099, (home:) ++39 (51) 727372; Fax: ++39 (51) 366964 (work only), Fidonet: 2:332/407.1138 (home only).
parker@mprgate.mpr.ca (Ross Parker) (05/28/91)
In article <1991May25.122537.19449@thunder.mcrcim.mcgill.edu>, mouse@thunder.mcrcim.mcgill.edu (der Mouse) writes: |> In article <138@speedy.ada.cci.de>, smeets@speedy.ada.cci.de (Vincent Smeets) writes: |> |> > I am using SunOS 4.1 and I want to execute some commands just before |> > the system is going down (shuting down Oracle and Teamwork). |> |> That's why shutting down sends a SIGTERM to everything. Processes that |> need to clean up after themselves should catch it and do whatever they |> feel they must. Definitely... unfortunately, init isn't as smart as we'd all like at times... (see next comment...) |> Not that I know of. If the commands in question execute fairly |> quickly, you could write a daemon which sleeps waiting for a SIGTERM |> and then runs whatever needs to be run. Unfortunately, init will not wait for all processes to die... only ones that it deems worthy of it's attention. I went through this exact problem a couple of months ago (trying to shut down Oracle), and eventually gave up. I had tried what you suggest - init will blast a SIGTERM at the daemon, but it will merrily continue on and take the system down. Databases take toooooo long to shut down! |> der Mouse |> |> old: mcgill-vision!mouse |> new: mouse@larry.mcrcim.mcgill.edu -- Ross Parker | Why do they put me down? | Make out that I'm a clown? parker@mprgate.mpr.ca | I drink scotch whisky all day long uunet!ubc-cs!mprgate!parker | Yeah I'm gonna save my money | (gonna put it all away...) (604)293-5495 | 'Cause I'm a Scotsman
csd35@seq1.keele.ac.uk (Jonathan Knight) (05/29/91)
From article <868@cadlab.sublink.ORG>, by albani@cadlab.sublink.ORG (Lanfranco Albani): > smeets@speedy.ada.cci.de (Vincent Smeets) writes: >>I have looked at the 'shutdown' program itself, but that is no >>shellscript so I can't change anything. > > Easy, make your own! :-) > Rename /etc/shutdown as /etc/shutdown.bin, write down a script like this: Nope, that's not really as useful as shutdown running a script. Suppose we run an Oracle server, then what we want is the Oracle server to shut down at shutdown time, not before anyone has had the shutdown message. It would be really useful to have shutdown execute a script so that servers can be neatly closed down at the right moment. -- ______ JANET :jonathan@uk.ac.keele.cs Jonathan Knight, / BITNET:jonathan%cs.kl.ac.uk@ukacrl Department of Computer Science / _ __ other :jonathan@cs.keele.ac.uk University of Keele, Keele, (_/ (_) / / UUCP :...!ukc!kl-cs!jonathan Staffordshire. ST5 5BG. U.K.
acarlson@laurel.math.umass.edu (Adam Carlson) (05/29/91)
In article <1214@keele.keele.ac.uk> csd35@seq1.keele.ac.uk (Jonathan Knight) writes: >From article <868@cadlab.sublink.ORG>, by albani@cadlab.sublink.ORG (Lanfranco Albani): >> smeets@speedy.ada.cci.de (Vincent Smeets) writes: >>>I have looked at the 'shutdown' program itself, but that is no >>>shellscript so I can't change anything. >> >> Easy, make your own! :-) >> Rename /etc/shutdown as /etc/shutdown.bin, write down a script like this: > > >Nope, that's not really as useful as shutdown running a script. Suppose >we run an Oracle server, then what we want is the Oracle server to shut >down at shutdown time, not before anyone has had the shutdown message. >It would be really useful to have shutdown execute a script so that >servers can be neatly closed down at the right moment. I don't know if this is standard, but on our Sun's we can give a shutdown -k command (the -k stands for "kidding") which will do everything but actually shutdown the machine (i.e. send shutdown messages, inhibit new logins from t-5 minutes.) So you can put a shutdown -k at the beginning of your script and then a shutdown now at the end. -- Adam Carlson | It's good to know that if I behave acarlson@math.umass.edu | strangely enough, society will take Statistical Consulting Center | full responsibility for me. UMass @ Amherst | - Ashleigh Brilliant
jharuni@micrognosis.co.uk (Jonathan Haruni) (05/31/91)
csd35@seq1.keele.ac.uk writes: > [that running a shellscript before shutdown does not offer the same > possibilities as running one just before the actual halt] The main reason shutdown is not a script is that it is suid-root, and it is not fashionable to have such shellscripts these days. But if you are contemplating having shutdown (which runs as root) call a shellscript, then you'd be no better off. You may as well just write your own shellscript which does exactly what you want, and use it instead of shutdown. Shutdown doesn't do very much anyway, and what it does do is specified very precisely in its manual entry. Write your shellscript, stick in a few calls to wall(8), sleep(1), logger(8), touch(1) (for /etc/nologin), and halt(8), then use your shellscript to stop the system. Regards, Jonathan Haruni jharuni@micrognosis.co.uk
rickert@mp.cs.niu.edu (Neil Rickert) (06/01/91)
In article <1991May31.164829.13125@micrognosis.co.uk> jharuni@micrognosis.co.uk (Jonathan Haruni) writes: > >The main reason shutdown is not a script is that it is suid-root, and >it is not fashionable to have such shellscripts these days. Not on my system. That would allow any peon to shutdown the system. >But if you are contemplating having shutdown (which runs as root) call >a shellscript, then you'd be no better off. You may as well just write Why is this? Most of the security holes in suid scripts are in the way the shell can be fooled while invoking the script, and not in the fact of using a script. Otherwise you would have to prohibit root from using any shell script ever. -- =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= Neil W. Rickert, Computer Science <rickert@cs.niu.edu> Northern Illinois Univ. DeKalb, IL 60115 +1-815-753-6940
philip@vogon.cetia.fr (Philip Peake) (06/05/91)
In article <1214@keele.keele.ac.uk>, csd35@seq1.keele.ac.uk (Jonathan Knight) writes: |> From article <868@cadlab.sublink.ORG>, by albani@cadlab.sublink.ORG (Lanfranco Albani): |> > smeets@speedy.ada.cci.de (Vincent Smeets) writes: |> >>I have looked at the 'shutdown' program itself, but that is no |> >>shellscript so I can't change anything. |> > |> > Easy, make your own! :-) |> > Rename /etc/shutdown as /etc/shutdown.bin, write down a script like this: |> |> |> Nope, that's not really as useful as shutdown running a script. Suppose |> we run an Oracle server, then what we want is the Oracle server to shut |> down at shutdown time, not before anyone has had the shutdown message. |> It would be really useful to have shutdown execute a script so that |> servers can be neatly closed down at the right moment. Am I missing something ? (maybe, since I keep as far away as possible from SunOS). The replacement shell script would be something like: Grab a message from the user - default to a generic message if only CR. /etc/wall the message sleep a little while zap oracle zap ingres zap whatever last warning before shutdown starts sleep a bit /etc/shutdown.bin This would work - no ? Philip