RE: rc* scripts to start/stop IDS
Posted in 2000
On Solaris (and most other UNIX's I can think of) the 'S' scripts are run at
startup and the 'K' scripts are run at shutdown. If you go digging through
the man pages and some of the system scripts you can see where these come into
play.
I use symbolic links between these files since I can recognize the link via ls
(ls -aCF). This is just a personal preference. You should use whatever you
like (or are more confortable with).
The script below looks good, but here is a quick rewrite (I usually use
something like it). Note how the common environmental variables are grouped
at the top so there is no duplication of effort. Check the man pages on su (I
am not sure about the -c syntax; I am currently using AIX).
#!/sbin/sh
#
# Informix start/stop script
INFORMIXDIR=/opt/informix
INFORMIXSERVER=ol_prueba_shm
ONCONFIG=onconfig.203
export INFORMIXDIR INFORMIXSERVER ONCONFIG
PATH=/bin:/usr/bin:/usr/ucb:$INFORMIXDIR/bin:$PATHexport PATH
case "$var" in
'start')
su - informix -c "$INFORMIXDIR/bin/oninit"
;;
'stop')
su - informix -c "$INFORMIXDIR/bin/onmode -yuck"
;;
esac
exit 0
# END
SC
>===== Original Message From "Sistema Unico \\(CNA\\)" <sisdis@tournet.com.ar>
=====
>Hi,
>
>Especial thanks to Mark and SC for their help. I followed their advice with
>respect to the edit scripts to start and stop the IDS engine on a Solaris 7
>OS. Here's that I did:
>
>1) Creation of the /etc/init.d/informix script
> informix -rwxr--r-- 3 root sys
>2) Link (hard link) to the following directory:
> /etc/rc0.d/K90informix -rwxr--r-- 3 root sys
>3) Link (hard link) to the following directory:
> /etc/rc3.d/S90informix -rwxr--r-- 3 root sys
>
>The informix script is here:
>
>#!/sbin/sh
>#Start of script
>
>case "$var" in
>'start')
> su - informix
> PATH=/usr/bin:/usr/ucb:/etc:.> export PATH
> TERM=vt100
> export TERM
> EDITOR=/bin/vi
> export EDITOR
> # Variables de entorno de Informix
> INFORMIXDIR=/opt/informix> export INFORMIXDIR
> PATH=$INFORMIXDIR/bin:$PATH> export PATH
> DBDATE=dmy4/> export DBDATE
> INFORMIXSERVER=ol_prueba_shm> export INFORMIXSERVER
> INFORMIXSQLHOSTS=/opt/informix/etc/sqlhosts> export INFORMIXSQLHOSTS
> ONCONFIG=onconfig.203> export ONCONFIG
> cd /opt/informix
> oninit
> ;;>
>'stop')
> su - informix
> PATH=/usr/bin:/usr/ucb:/etc:.> export PATH
> TERM=vt100
> export TERM
> EDITOR=/bin/vi
> export EDITOR
> # Variables de entorno de Informix
> INFORMIXDIR=/opt/informix> export INFORMIXDIR
> PATH=$INFORMIXDIR/bin:$PATH> export PATH
> DBDATE=dmy4/> export DBDATE
> INFORMIXSERVER=ol_prueba_shm> export INFORMIXSERVER
> INFORMIXSQLHOSTS=/opt/informix/etc/sqlhosts> export INFORMIXSQLHOSTS
> ONCONFIG=onconfig.203> export ONCONFIG
> cd /opt/informix
> onmode -ky
> ;;>esac
>
>exit 0
>#End of script
>
>I reboot the machine and the engine doesn't start.
>But, if I separately run the start case script and the stop case script on a
>root terminal, they run OK: the engine start and stop. I think I have a
>problem in the owner, permissions or type of links of the scripts I edited
>(informix, S90informix and K90informix). At last, why did you tell me to put
>90 in the S and K scripts ???
>
>I'm very thanked.
>
>Yours,
>
>Alejandro Cabrera Obed
>Responsable Area Informatica
>Sistema Unico de Prestaciones para Personas con Discapacidad
>Tel. 54 11 4331-7344 int 5527
>http://www.sisdis.gov.ar
>E-mail: sisdis@tournet.com.ar
>Bs. As. - Argentina
>
>
>.