Jump to content

Problem adding a service


Recommended Posts

I was attempting to speed up my boot time based on a post here:

 

http://www.mandrakeusers.org/viewtopic.php?p=5202#5202

 

So I wrote a script and made it executable. The script looks like this:

 

#!/bin/bash

case $1 in

start)

( sleep 1m; bash >/dev/null 2>&1 <<-FIN

       /etc/rc.d/init.d/arpwatch start

       /etc/rc.d/init.d/leafnode start

       /etc/rc.d/init.d/swat start

       /etc/rc.d/init.d/alsa start

       /etc/rc.d/init.d/anacron start

       /etc/rc.d/init.d/atd start

/etc/rc.d/init.d/bastille-firewall start

/etc/rc.d/init.d/crond start

/etc/rc.d/init.d/dhcpd start

/etc/rc.d/init.d/gpm start

/etc/rc.d/init.d/harddrake start

/etc/rc.d/init.d/ip6tables start

/etc/rc.d/init.d/iptables start

/etc/rc.d/init.d/ipvsadm start

/etc/rc.d/init.d/kheader start

/etc/rc.d/init.d/linuxconf start

/etc/rc.d/init.d/medusa-init start

/etc/rc.d/init.d/netfs start

/etc/rc.d/init.d/ntpd start

/etc/rc.d/init.d/portmap start

/etc/rc.d/init.d/psacct start

/etc/rc.d/init.d/random start

/etc/rc.d/init.d/rawdevices start

/etc/rc.d/init.d/smb start

/etc/rc.d/init.d/sound start

/etc/rc.d/init.d/squid start

/etc/rc.d/init.d/usb start

/etc/rc.d/init.d/vncserver start

/etc/rc.d/init.d/webmin start

FIN

) &
;;

stop)

       /etc/rc.d/init.d/arpwatch stop

       /etc/rc.d/init.d/leafnode stop

       /etc/rc.d/init.d/swat stop

       /etc/rc.d/init.d/alsa stop

       /etc/rc.d/init.d/anacron stop

       /etc/rc.d/init.d/atd stop

/etc/rc.d/init.d/bastille-firewall stop

/etc/rc.d/init.d/crond stop

/etc/rc.d/init.d/dhcpd stop

/etc/rc.d/init.d/gpm stop

/etc/rc.d/init.d/harddrake stop

/etc/rc.d/init.d/ip6tables stop

/etc/rc.d/init.d/iptables stop

/etc/rc.d/init.d/ipvsadm stop

/etc/rc.d/init.d/kheader stop

/etc/rc.d/init.d/linuxconf stop

/etc/rc.d/init.d/medusa-init stop

/etc/rc.d/init.d/netfs stop

/etc/rc.d/init.d/ntpd stop

/etc/rc.d/init.d/portmap stop

/etc/rc.d/init.d/psacct stop

/etc/rc.d/init.d/random stop

/etc/rc.d/init.d/rawdevices stop

/etc/rc.d/init.d/smb stop

/etc/rc.d/init.d/sound stop

/etc/rc.d/init.d/squid stop

/etc/rc.d/init.d/usb stop

/etc/rc.d/init.d/vncserver stop

/etc/rc.d/init.d/webmin stop
;;

restart)

       /etc/rc.d/init.d/arpwatch restart

       /etc/rc.d/init.d/leafnode restart

       /etc/rc.d/init.d/swat restart

       /etc/rc.d/init.d/alsa restart

       /etc/rc.d/init.d/anacron restart

       /etc/rc.d/init.d/atd restart

/etc/rc.d/init.d/bastille-firewall restart

/etc/rc.d/init.d/crond restart

/etc/rc.d/init.d/dhcpd restart

/etc/rc.d/init.d/gpm restart

/etc/rc.d/init.d/harddrake restart

/etc/rc.d/init.d/ip6tables restart

/etc/rc.d/init.d/iptables restart

/etc/rc.d/init.d/ipvsadm restart

/etc/rc.d/init.d/kheader restart

/etc/rc.d/init.d/linuxconf restart

/etc/rc.d/init.d/medusa-init restart

/etc/rc.d/init.d/netfs restart

/etc/rc.d/init.d/ntpd restart

/etc/rc.d/init.d/portmap restart

/etc/rc.d/init.d/psacct restart

/etc/rc.d/init.d/random restart

/etc/rc.d/init.d/rawdevices restart

/etc/rc.d/init.d/smb restart

/etc/rc.d/init.d/sound restart

/etc/rc.d/init.d/squid restart

/etc/rc.d/init.d/usb restart

/etc/rc.d/init.d/vncserver restart

/etc/rc.d/init.d/webmin restart
;;

esac

rc3.d and

I put it in /etc/rc.d/init.d. I then placed a symlink in /etc/rc.d/rc3.d and /etc/rc.d/rc5.d to run it at bootlevel 3 and 5:

lrwxrwxrwx    1 root     root           20 Dec 30 03:24 S02myservices -> ../init.d/myservices*

 

At boot time, it shows that it starts, but half the stuff in the script doesn't start (smb, linuxconf, webmin, lo, vncserver). What did I do wrong? Here is the file list of /etc/rc.d/init.d:

[root@omar init.d]# ls -l

total 280

-rwxr-xr-x    1 root     root         6610 Dec 18 22:48 alsa*

-rwxr-xr-x    1 root     root         1191 Dec 18 22:48 anacron*

-rwxr-xr-x    1 root     root         1459 Dec 18 22:48 apmd*

-rwxr-xr-x    1 root     root          725 Dec 18 22:48 arpwatch*

-rwxr-xr-x    1 root     root         1177 Dec 18 22:48 atd*

-r-x------    1 root     root         2383 Dec 24 23:54 bastille-firewall*

-rwxr-xr-x    1 root     root         1316 Dec 18 22:48 crond*

-rwxr-xr-x    1 root     root         2199 Dec 18 22:48 dhcpd*

-rwxr-xr-x    1 root     root        12868 Dec 18 22:48 functions*

-rwxr-xr-x    1 root     root         1468 Dec 18 22:48 gpm*

-rwxr-xr-x    1 root     root         5664 Dec 18 22:48 halt*

-rwxr-xr-x    1 root     root         1078 Dec 18 22:48 harddrake*

-rwxr-xr-x    1 root     root         5307 Dec 18 22:48 httpd*

-rwxr-xr-x    1 root     root         1750 Dec 18 22:48 innd*

-rwxr-xr-x    1 root     root         1043 Dec 18 22:48 internet*

-rwxr-xr-x    1 root     root         5549 Dec 24 18:49 ip6tables*

-rwxr--r--    1 root     root          928 Dec 18 22:48 iplog*

-rwxr-xr-x    1 root     root         5528 Dec 24 18:49 iptables*

-rwxr-xr-x    1 root     root         2421 Dec 18 22:48 ipvsadm*

-rwxr-xr-x    1 root     root         2432 Dec 18 22:48 keytable*

-rwxr-xr-x    1 root     root         1687 Dec 18 22:48 kheader*

-rwxr-xr-x    1 root     root          487 Dec 18 22:48 killall*

-rwxr-xr-x    1 root     root         2334 Dec 18 22:48 kudzu*

-rwxr-xr-x    1 root     root          710 Dec 18 22:48 linuxconf*

-rw-r--r--    1 root     root          318 Dec 18 22:48 mandrake_consmap

-rwxr-xr-x    1 root     root         2420 Dec 18 22:48 mandrake_everytime*

-rwxr-xr-x    1 root     root         1074 Dec 18 22:48 mandrake_firstime*

-rwxr-xr-x    1 root     root         1210 Dec 18 22:48 medusa-init*

-rwxr-xr-x    1 root     root         3015 Dec 30 04:45 myservices*

-rwxr-xr-x    1 root     root         3015 Dec 30 04:24 myservices2*

-rwxr-xr-x    1 root     root         4294 Dec 18 22:48 mysql*

-rwxr-xr-x    1 root     root         1791 Dec 24 23:54 named*

-rwxr-xr-x    1 root     root         4026 Dec 18 22:48 netfs*

-rwxr-xr-x    1 root     root         8450 Dec 18 22:48 network*

-rwxr-xr-x    1 root     root         3085 Dec 18 22:48 nfs*

-rwxr-xr-x    1 root     root         1956 Dec 18 22:48 nfslock*

-rwxr-xr-x    1 root     root         1228 Aug 28  2001 ntpd*

-rwxr-xr-x    1 root     root         1079 Dec 18 22:48 numlock*

-rwxr-xr-x    1 root     root         1086 Dec 18 22:48 portmap*

-rwxr-xr-x    1 root     root         1175 Dec 18 22:48 postfix*

-rwxr-xr-x    1 root     root         4225 Dec 18 22:48 postgresql*

-rwxr-xr-x    1 root     root          545 Dec 18 22:48 psacct*

-rwxr-xr-x    1 root     root         1557 Dec 18 22:48 random*

-rwxr-xr-x    1 root     root         2346 Dec 18 22:48 rawdevices*

-rwxr-xr-x    1 root     root         1636 Dec 18 22:48 single*

-rwxr-xr-x    1 root     root         1780 Dec 18 22:48 smb*

-rwxr-xr-x    1 root     root         2315 Dec 18 22:48 sound*

-rwxr-xr-x    1 root     nobody       2787 Dec 18 22:48 squid*

-rwxr-xr-x    1 root     root         2434 Dec 18 22:48 sshd*

-rwxr-xr-x    1 root     root         3588 Dec 18 22:48 sympa*

-rwxr--r--    1 root     root         2009 Dec 24 23:54 syslog*

-rwxr-xr-x    1 root     root         6091 Dec 18 22:48 usb*

-rwxr-xr-x    1 root     root         1706 Dec 18 22:48 vncserver*

-rwxr-xr-x    1 root     root         1354 Dec 18 22:48 webmin*

-rwxr-xr-x    1 root     root          666 Dec 18 22:48 wine*

-rwxr-xr-x    1 root     root          986 Dec 18 22:48 xfs*

-rwxr-xr-x    1 root     root         2445 Dec 18 22:48 xinetd*

 

TIA,

Link to comment
Share on other sites

What did I do wrong?
The init scripts are thougth to start in a certain order, that's why the links to them are numbered (as in /etc/rc5.d/S01blabla, etc/rc5.d/S70blabla). That's because some of those services, in order to work, need other services running before they can start, ie: "nfs" needs "network" and "portmap" (and maybe others) running before "nfs" itself.

 

So order the services you are launching in the sameway they are under the /etc/rc#.d directories

 

For example, a good idea ( :P ) could be: create a /etc/rc.d/quick_boot/ dir and link the init scripts at /etc/rc.d/init.d/ the sameway they are linked in /etc/rc5.d/ (S01blabla, S05foo...); and call them with a script which could be something like this:

 

#!/bin/bash

case $1 in

      start)  (sleep 1m && 

                 for script in /etc/rc.d/quick_boot/*; do

                          $script start

                 done) &;;

      stop)  for script in /etc/rc.d/quick_boot/*; do

                          $script stop

                  done;;

      restart) for script in /etc/rc.d/quick_boot/*; do

                          $script restart

                  done;;

      *) exit 1;;

esac

 

BTW, I'm glad to see you around here Omar :D

 

EDITED: check out the code! removed some unwanted blankspaces (sorry, opera is not the best script editor I've used)

Link to comment
Share on other sites

BTW, I'm glad to see you around here Omar  :D

 

Thanks. It's good to be back.

 

I think this did the trick. I won't know till I reboot and I can't right now because I'm d/l-ing a 40MB file on dialup and there is no resume on it...LOL....Man, I miss my DSL.

 

Thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...