Script to create startup scripts in /etc/init.d or /etc/rc?.d

Script to create startup scripts in /etc/init.d or /etc/rc?.d

Post by Gildas PERR » Thu, 17 Apr 2003 23:33:07



Hi,

Does anyone has already find a script which creates a startup script
in /etc/init.d and its hard links in /etc/rc?.d ?

Thanks in advance for your help.

Gildas.

 
 
 

Script to create startup scripts in /etc/init.d or /etc/rc?.d

Post by Martin Pau » Fri, 18 Apr 2003 16:50:12



> Does anyone has already find a script which creates a startup script
> in /etc/init.d and its hard links in /etc/rc?.d ?

What would you expect such a script to do ? The real work is to
come up with what goes into /etc/init.d/xxx and to decide on
the run level and the number yy in rc*.d/Syyxxx and rc*.d/Kyyxxx
(ie. when in the boot stage the script should run).

Creating the links is the least work, which you just as well
do manually.

mp.
--
                         Martin Paul | Systems Administrator

       University of Vienna, Austria | http://www.par.univie.ac.at/

 
 
 

Script to create startup scripts in /etc/init.d or /etc/rc?.d

Post by Darren Dunha » Sat, 19 Apr 2003 05:35:35



> Hi,
> Does anyone has already find a script which creates a startup script
> in /etc/init.d and its hard links in /etc/rc?.d ?

I have no idea what you're asking.  What should the startup script be?
Why would another script be creating it?

#!/bin/sh
cat > /etc/init.d/createdstartupscript <<EOF
#!/bin/sh
#
# the startupscript goes here
EOF
ln /etc/init.d/createdstartupscript /etc/rc2.d/S99createdstartupscript
ln /etc/init.d/createdstartupscript /etc/rc0.d/K01createdstartupscript
ln /etc/init.d/createdstartupscript /etc/rc1.d/K01createdstartupscript

--

Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >

 
 
 

Script to create startup scripts in /etc/init.d or /etc/rc?.d

Post by scriptOmati » Sat, 19 Apr 2003 05:48:17




> > Hi,

> > Does anyone has already find a script which creates a startup script
> > in /etc/init.d and its hard links in /etc/rc?.d ?

> I have no idea what you're asking.  What should the startup script be?
> Why would another script be creating it?

> #!/bin/sh
> cat > /etc/init.d/createdstartupscript <<EOF
> #!/bin/sh
> #
> # the startupscript goes here
> EOF
> ln /etc/init.d/createdstartupscript /etc/rc2.d/S99createdstartupscript
> ln /etc/init.d/createdstartupscript /etc/rc0.d/K01createdstartupscript
> ln /etc/init.d/createdstartupscript /etc/rc1.d/K01createdstartupscript

> --

> Unix System Administrator                    Taos - The SysAdmin Company
> Got some Dr Pepper?                           San Francisco, CA bay area
>          < This line left intentionally blank to confuse you. >

I don't know if this helps but here is my standard "BareBones.template"
I use to create solaris/linux startup scripts.

#! /sbin/sh

S_LINK="/etc/rc3.d/SNNNname"; # one or more names
K_LINK="/etc/rc0.d/KNNNname"; # one or more names
T_LINK="/etc/init.d/name";    # one name

case "$1" in

start)
        :
        ;;

stop)
        :
        ;;

restart)
        ${0} stop;
        ${0} start;
        ;;

link)
        if [ ! -z "${T_LINK}" ]; then
            if [ -f "${T_LINK}" ]; then
                if ${0} unlink; then
                    for link in ${S_LINK} ${K_LINK}; do
                        /bin/ln ${SYM} ${T_LINK} ${link};
                    done
                    /bin/ls -l ${T_LINK} ${S_LINK} ${K_LINK}
                 else
                     echo ${0} unlink failed, can not link, aborting!;
exit 1;
                 fi
            else
                echo ${0} ${T_LINK} not installed, aborting!; exit 1;
            fi
        else
            echo ${0} variable T_LINK not installed, aborting!; exit 1;
        fi
        ;;

unlink)
        if [ ! -z "${T_LINK}" ]; then
            if [ -f ${T_LINK} ]; then
                echo /bin/rm -f ${S_LINK} ${K_LINK};
                     /bin/rm -f ${S_LINK} ${K_LINK};
            else
                echo $ ${0}{T_LINK} not installed, aborting!; exit 1;
            fi
        else
            echo ${0} variable T_LINK not installed, aborting!; exit 1;
        fi
        ;;

*)
        echo "usage: ${0} {start | stop | restart | link | unlink }"
        ;;
esac

exit 1;

--
http://ftp.opensysmon.com is a shell script archive site with an
open source system monitoring and network monitoring software package.
Many platforms are supplied already compiled.

 
 
 

1. Startup Script in /etc/rc.d/rc3.d Doesn't Seem to Work.

Hi Experts:

   I'm a Solaris programmer.  My system admin skills are
poor, and worse when applied to Linux.

   I'm trying to export /home on my Redhat 6.2 PC (linux-1)
to my Solaris PC (tiamtt).

      When Solaris comes up, it complains:

      nfs mount: linux-1: : RPC: Program not registered
      nfs mount: backgrounding: /usr/local/mount_points/nfs/linux-1/home

   I have symbolically linked /etc/rc.d/init.d/nfs to
/etc/rc.d/rc3.d/S95nfs.  I tried S20nfs first, I changed
it's name to a larger number to see if running the script
latter would make a difference.  It doesn't make a  
difference.


   ... /etc/rc.d/rc3.d/S95nfs -> ../init.d/nfs

   When I enter the following on the command line I get:


Starting NFS services:                          [  OK  ]
Starting NFS quotas:                            [  OK  ]
Starting NFS mountd:                            [  OK  ]
Starting NFS daemon:                            [  OK  ]

   After doing this I'm still having "access denied"
problems mounting the Linux partition from Solaris, but
it's closer to succeeding.

   Shutting down Linux shows some messages that suggest
that NFS isn't being properly shut down.  Even though
rc3.d has a file called K20nfs:

      ls -l /etc/rc.d/rc3.d/K20nfs
     ... /etc/rc.d/rc3.d/K20nfs -> ../init.d/nfs

   So neither the NFS startup or shutdown script seem to
be working.  I've never been real clear.  Should I be
putting the links to "/etc/rc.d/init.d/nfs start" in    
"/etc/rc.d/rc2.d"?

   My question is, why isn't "/etc/rc.d/init.d/nfs start"
run with the startup scripts by the existence of the link
/etc/rc.d/rc3.d/S95nfs?  

                                                   Thanks
                                                   Larry

2. Have you seen this error?

3. Scripts in /usr/local/etc/rc.d wont execute at startup

4. Answerbook on Solaris 2.3

5. difference between /etc/rc.sysinit and /etc/rc.d/rc.sysinit ?

6. natd problems

7. /etc/init.d startup scripts

8. Unable to use ethernet after suspend and smbmount (laptop)

9. linux refuses to execute rc.M and other /etc/rc.d scripts

10. xfs + KDE slow startup: bug in RH8 /etc/rc.d/init.d/xfs ?

11. /etc/rc: sendmail parms don't match /etc/rc.conf

12. /etc/rc.d/rc.sysinit: /etc/sysconfig/keyboard: No such file or directory

13. init: cannot execute "/etc/rc.d/rc.S"