Shutdown script for linux
Posted in 1999
Topics: Platform-Specific Issues
Hi,
I am using ids-7.30.UC5-1 on Linux RedHat5.2. I would like to bring
informix online when machine is started, and take informix offline when
machine is shut downed.
I create script inf in /etc/rc.d/init.d directory:
#!/bin/sh
INFORMIXDIR=/opt/informix ; export INFORMIXDIR
PATH=/bin:/etc:$INFORMIXDIR/bin ; export PATH
case "$1" in
start)
su -c "oninit" informix
echo "Pokrecem INFORMIX."
if test $? = "0"
then
echo "INFORMIX uspjesno pokrenut!"
else
echo "INFORMIX NIJE uspjesno pokrenut!"
fi
;;
*)
echo "Usage: $0 { start | stop }" >&2
;;
esac
exit 0
I also created symbolic links in following directories:
./rc0.d/K95inf
./rc1.d/K95inf
./rc2.d/S95inf
./rc3.d/S95inf
./rc5.d/S95inf
./rc6.d/K95inf
I can automatic bring informix online with such configuration, but I
cannot take informix offline when I shut down machine (via shutdown 0).
Any ideas?
+--------------------------+-----------------------------+
| Zeljan Silje | e-mail: zeljan@laus.hr |
| CC Computer Consulting | |
| Put Republike 7 | Tel: +385 (20) 356-877 |
| 20 000 Dubrovnik | Fax: +385 (20) 356-877 |
| Hrvatska (Croatia) | URL: http://www.laus.hr |
+--------------------------+-----------------------------+
What about the INFORMIXSERVER (and ONCONFIG) environment variables?
Rudy
Zeljan Silje wrote:
> #!/bin/sh
>
> INFORMIXDIR=/opt/informix ; export INFORMIXDIR
> PATH=/bin:/etc:$INFORMIXDIR/bin ; export PATH>
> +--------------------------+-----------------------------+
Zeljan Silje wrote:
>
> Hi,
>
> I am using ids-7.30.UC5-1 on Linux RedHat5.2. I would like to bring
> informix online when machine is started, and take informix offline when
> machine is shut downed.
> I create script inf in /etc/rc.d/init.d directory:
> #!/bin/sh
>
> INFORMIXDIR=/opt/informix ; export INFORMIXDIR
> PATH=/bin:/etc:$INFORMIXDIR/bin ; export PATH>
> case "$1" in
> start)
> su -c "oninit" informix
> echo "Pokrecem INFORMIX."
> if test $? = "0"
> then
> echo "INFORMIX uspjesno pokrenut!"
> else
> echo "INFORMIX NIJE uspjesno pokrenut!"
> fi
> ;;
> *)
> echo "Usage: $0 { start | stop }" >&2
> ;;
> esac
> exit 0
>
> I also created symbolic links in following directories:
> ./rc0.d/K95inf
> ./rc1.d/K95inf
> ./rc2.d/S95inf
> ./rc3.d/S95inf
> ./rc5.d/S95inf
> ./rc6.d/K95inf
>
> I can automatic bring informix online with such configuration, but I
> cannot take informix offline when I shut down machine (via shutdown 0).
>
> Any ideas?
>
> +--------------------------+-----------------------------+
> | Zeljan Silje | e-mail: zeljan@laus.hr |
> | CC Computer Consulting | |
> | Put Republike 7 | Tel: +385 (20) 356-877 |
> | 20 000 Dubrovnik | Fax: +385 (20) 356-877 |
> | Hrvatska (Croatia) | URL: http://www.laus.hr |
> +--------------------------+-----------------------------+
In the K??-Scripts the Informix-command should be something
like "onmode -ky" to bring Informix offline.
Pay attention that You use the -y option to answer al questions
automatically with YES.
Wolfgang
Zeljan Silje <zeljan@laus.hr> wrote: > > Hi, > > I am using ids-7.30.UC5-1 on Linux RedHat5.2. I would like to bring > informix online when machine is started, and take informix offline when > machine is shut downed. > I create script inf in /etc/rc.d/init.d directory: > #!/bin/sh > <snip> > I can automatic bring informix online with such configuration, but I > cannot take informix offline when I shut down machine (via shutdown 0). > 'stop') echo "Waiting for database activity to finish ... " $INFORMIXDIR/bin/onmode -s -y echo "Closing Informix Dynamic Server ... " $INFORMIXDIR/bin/onmode -k -y ;; /J\\ -- "I'm about to say a naughty word so if you're easily offended you can fuck off now" - Daisy Donovan, The 11 O'Clock Show
In addition to all the other points people made, you should look carefully
at the other scripts in the /etc/rc.d directory. Under RH6.0 at any rate
(I've not checked 5.2), you have to do more work than on other systems.
You have to create a file in a location under /var, and your shutdown
script will only be called if the file indicates that the system was
brought up successfully. Nice touch, but completely different from any
other Unix system!
Zeljan Silje wrote:
> Hi,
>
> I am using ids-7.30.UC5-1 on Linux RedHat5.2. I would like to bring
> informix online when machine is started, and take informix offline when
> machine is shut downed.
> I create script inf in /etc/rc.d/init.d directory:
> #!/bin/sh
>
> INFORMIXDIR=/opt/informix ; export INFORMIXDIR
> PATH=/bin:/etc:$INFORMIXDIR/bin ; export PATH>
> case "$1" in
> start)
> su -c "oninit" informix
> echo "Pokrecem INFORMIX."
> if test $? = "0"
> then
> echo "INFORMIX uspjesno pokrenut!"
> else
> echo "INFORMIX NIJE uspjesno pokrenut!"
> fi
> ;;
> *)
> echo "Usage: $0 { start | stop }" >&2
> ;;
> esac
> exit 0
>
> I also created symbolic links in following directories:
> ./rc0.d/K95inf
> ./rc1.d/K95inf
> ./rc2.d/S95inf
> ./rc3.d/S95inf
> ./rc5.d/S95inf
> ./rc6.d/K95inf
>
> I can automatic bring informix online with such configuration, but I
> cannot take informix offline when I shut down machine (via shutdown 0).
>
> Any ideas?
>
> +--------------------------+-----------------------------+
> | Zeljan Silje | e-mail: zeljan@laus.hr |
> | CC Computer Consulting | |
> | Put Republike 7 | Tel: +385 (20) 356-877 |
> | 20 000 Dubrovnik | Fax: +385 (20) 356-877 |
> | Hrvatska (Croatia) | URL: http://www.laus.hr |
> +--------------------------+-----------------------------+
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v0.62 -- see http://www.perl.com/CPAN
#include <disclaimer.h>