[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: managing /etc/rc?.d



On Thu, Aug 30, 2001 at 04:03:47AM +0200, Martin F Krafft wrote:
> folks,
> despite wonderful packages like file-rc, the /etc/rc?.d structure is
> damn difficult to maintain, is it not? in fact, here is the only tool
> that i miss from my redhat days - some text-oriented tool which let
> you specify the order and runlevels of each of the scripts in
> /etc/init.d. is there something like that?
> 
> how do you guys manage these?

I created the attached script to manage rc*d.  It is a little rough as it 
is my first write but it works for my needs at the moment.
kent

 
#! /bin/sh
# update-rc
# used to update links in rc*.d directories
# ktb

script=$2
link=$3
link_remove=$2


case "$1" in
    create_all)
        for i in /etc/rc{2,3,4,5}.d; do
          ln -sv /etc/init.d/$script $i/S$link
        done

       	  echo ""
	 
        for i in /etc/rc{0,1,6}.d; do
          ln -sv /etc/init.d/$script $i/K$link
        done
        ;;

    createS)
        for i in /etc/rc{2,3,4,5}.d; do
            ln -sv /etc/init.d/$script $i/S$link
        done 
        ;;

    remove)
        for i in /etc/rc{0,1,2,3,4,5,6}.d; do
            rm -v $i/$link_remove
        done
        ;;

    createK)
        for i in /etc/rc{0,1,6}.d; do
            ln -sv /etc/init.d/$script $i/K$link
        done
        ;;

    --help)
        echo "Usage: $0  (create_all) script_name NNNlink_to_script"
        echo "Usage: $0  (createS|createK) script_name NNNlink_to_script"
        echo "Usage: $0 (remove) [*]link_to_script"
        exit 1
        ;;

    *)
        echo "Usage: $0  (create_all) script_name NNNlink_to_script"
        echo "Usage: $0  ([createS|createK]) script_name NNNlink_to_script"
        echo "Usage: $0 (remove) [*]link_to_script"
        exit 1
        ;;
esac
exit 0


Reply to: