[SOLVED] recommended way of modifying /etc/rc.d/rc.M from a script?
by FlinchX from LinuxQuestions.org on (#575T5)
I need to modify /etc/rc.d/rc.M and add a generic startup block for a third party daemon:
Code:if [ -x /etc/rc.d/rc.foo ]; then
/etc/rc.d/rc.foo start
fiWhat is the recommended way to do this from a script?
I can't just append the block to the end of the file, because I need to insert it in a custom location (order of daemons matter sometimes, since some rely on others already running).
I don't like the idea of doing it by hand, make a diff then just apply the patch to the default rc.M script, because it does not scale well for multiple similar actions.
Currently I'm leaning towards reading rc.M line by line until I find the location where I need to add my block, add it then add the rest of original rc.M below - basically emulating how would I do it manually.
Are there any other less obvious approaches that Slackware users use to solve this generic problem?


Code:if [ -x /etc/rc.d/rc.foo ]; then
/etc/rc.d/rc.foo start
fiWhat is the recommended way to do this from a script?
I can't just append the block to the end of the file, because I need to insert it in a custom location (order of daemons matter sometimes, since some rely on others already running).
I don't like the idea of doing it by hand, make a diff then just apply the patch to the default rc.M script, because it does not scale well for multiple similar actions.
Currently I'm leaning towards reading rc.M line by line until I find the location where I need to add my block, add it then add the rest of original rc.M below - basically emulating how would I do it manually.
Are there any other less obvious approaches that Slackware users use to solve this generic problem?