Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

267 views
Skip to first unread message

Gildas PERROT

unread,
Apr 16, 2003, 10:33:07 AM4/16/03
to
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.

Martin Paul

unread,
Apr 17, 2003, 3:50:12 AM4/17/03
to
Gildas PERROT <gildas...@edfgdf.fr> wrote:
> 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
Institute for Software Science | mar...@par.univie.ac.at
University of Vienna, Austria | http://www.par.univie.ac.at/

Darren Dunham

unread,
Apr 17, 2003, 4:35:35 PM4/17/03
to
Gildas PERROT <gildas...@edfgdf.fr> wrote:
> 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

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

scriptOmatic

unread,
Apr 17, 2003, 4:48:17 PM4/17/03
to

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.

0 new messages