where to put shutdown script
Posted in 2004
Topics: Server Administration
In order for the IDS online server to stop properly before the linux
OS shuts down, I created a shutdonw script that contains 'onmode -kuy' among
other things. The problem is that it doesn't seem to have a chance being
executed. I tried putting the link pointing to this script at
'/etc/rc.d/rc0.d', '/etc/rc.d/rc1.d', etc. I also tried looking for the file
'/etc/shutdown' as mentions in the Informix Handbook, but it does not exist.
Any help is appreciated.
I
am not a Linux guy, but food for thought...different methods of
shutting down
follow different logics of shutting down.
/etc/reboot does not run the shutdown scripts in rc3.d, shutdown command
does.
I added the following lines to the /etc/init.d/informix (the shutdown
script on my system) to allow me to see exactly which rc.d directory was
controlling my shutdowns with different shutdown commands. You can also
read the various man pages, but heck, this is more fun.
echo "Shutting down Informix Dynamic Server... "
echo "\\
$0 Shutting down Informix Dynamic Server...\\
"
>>$INFORMIXDIR/online.log
An indirect answer I know, but I hope it helps.
Sam
-----Original Message-----
From: LIXIN WU [mailto:lixinwufeng@yahoo.com]
Sent: Wednesday, March 10, 2004 2:33 PM
To: ids@iiug.org
Subject: where to put shutdown script [2652]
In order for the IDS online server to stop properly before the linux OS
shuts down, I created a shutdonw script that contains 'onmode -kuy'
among other things. The problem is that it doesn't seem to have a
chance being executed. I tried putting the link pointing to this script
at '/etc/rc.d/rc0.d', '/etc/rc.d/rc1.d', etc. I also tried looking for
the file '/etc/shutdown' as mentions in the Informix Handbook, but it
does not exist.
Any help is appreciated.
Depends on what you are using for shutdown. These days /etc/init.d is very
popular - in which case you can create a startup/shutdown script there and
link it to /etc/rc2.d (did I get that right?) with an S98Informix (or
whatever - an S for Start, and a high number to be late) and a K02informix
(again K for kill and low number for early). Look at the contents of
/etc/init.d for examples - but then your specific Unix version may still be
using inittab for all I know.
cheers
j.
----- Original Message -----
From: "LIXIN WU" <lixinwufeng@yahoo.com>
To: <ids@iiug.org>
Sent: Wednesday, March 10, 2004 5:32 PM
Subject: where to put shutdown script [2652]
> In order for the IDS online server to stop properly before the linux OS
shuts down, I created a shutdonw script that contains 'onmode -kuy' among
other things. The problem is that it doesn't seem to have a chance being
executed. I tried putting the link pointing to this script at
'/etc/rc.d/rc0.d', '/etc/rc.d/rc1.d', etc. I also tried looking for the file
'/etc/shutdown' as mentions in the Informix Handbook, but it does not exist.
> Any help is appreciated.
>
>
If you've
created a script in /etc/init.d for informix, the script
should generally accept arguments "start" and "stop" which perform the
necessary oninit and onmode -ky commands.
The links in the /etc/rc[0-6].d directories should all reference the
/etc/init.d/informix script and should be named according to the convention:
Sxxxinformix where xxx is a three digit number
Kyyyinformix where yyy = 1000 - xxx (usually)
Basically, when the system changes run-level, these links are inspected,
and run depending on whether the run-level is increasing or decreasing.
So, from level 1-> level 2, the Sxxx scripts are detected and the script
is run with a "start" argument whereas for a decreasing level the Kxxx
scripts are used to supply the script with a "stop" argument.
Depending on your linux distro, these links might be created for you
using the chkconfig command:
chkconfig --add informix
(as long as the script /etc/init.d/informix exists and is executable)
Then chkconfig --list informix will show the state of the informix
startup at various run-levels:
$ chkconfig --list informix
informix 0:off 1:off 2:off 3:on 4:off 5:off 6:off
In the above example, the only instance that informix will be
started/shutdown will be when the system enters run level 3. You can
change the above switches using the command:
chkconfig --level n[...] informix {on|off}
e.g. chkconfig --level 234 informix on
will turn the informix startup/shutdown script on at run-levels 2,3 and 4.
who -r
will/should show you your current run-level and is probably the level at
which you want to turn the script on. System shutdown is level 0, so you
might want to turn the script on for level 0 also.
Hope this helps
Rob
Gentsch, Sam wrote:
> I am not a Linux guy, but food for thought...different methods of
> shutting down
> follow different logics of shutting down.
>
> /etc/reboot does not run the shutdown scripts in rc3.d, shutdown command
> does.
>
> I added the following lines to the /etc/init.d/informix (the shutdown
> script on my system) to allow me to see exactly which rc.d directory was
> controlling my shutdowns with different shutdown commands. You can also
> read the various man pages, but heck, this is more fun.
>
> echo "Shutting down Informix Dynamic Server... "
> echo "\\
$0 Shutting down Informix Dynamic Server...\\
"
>
>>>$INFORMIXDIR/online.log
>
>
> An indirect answer I know, but I hope it helps.
>
> Sam
>
> -----Original Message-----
> From: LIXIN WU [mailto:lixinwufeng@yahoo.com]
> Sent: Wednesday, March 10, 2004 2:33 PM
> To: ids@iiug.org
> Subject: where to put shutdown script [2652]
>
>
> In order for the IDS online server to stop properly before the linux OS
> shuts down, I created a shutdonw script that contains 'onmode -kuy'
> among other things. The problem is that it doesn't seem to have a
> chance being executed. I tried putting the link pointing to this script
> at '/etc/rc.d/rc0.d', '/etc/rc.d/rc1.d', etc. I also tried looking for
> the file '/etc/shutdown' as mentions in the Informix Handbook, but it
> does not exist.
> Any help is appreciated.
>
>
>
>
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
Hi, I am using linux red hat and I am sure for all other flavors is the same. Just store script in init.d and link it to the rc5.d directory. Carl