Linux initd: 'Kill' script not being called at runlevel 6 (shutdown)

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I'm confused.
I thought i knew how the Linux init scripts worked, and it seems i do not.
For reference I'm working on a slightly elderly CentOS5.7.



I have written this script which basically does nothing other then print messages:



# cat /etc/init.d/dom 

#!/bin/bash
#
# chkconfig: 345 95 5
# description: NOP test
# processname: dom

# Source function library.
. /etc/init.d/functions


RETVAL=0
prog="dom"

start()
echo -n $"Starting $prog: "
echo
return $RETVAL


stop()
echo -n $"Stopping $prog: "
echo
return $RETVAL


restart()
stop
start


reload()
restart


status_at()
echo "OK"


case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart)
restart
;;
condrestart)
restart
;;
status)
status_at
;;
*)
echo $"Usage: $0 start"
exit 1
esac

exit $?
exit $RETVAL


Once I copied it into /etc/init.d/ the I added it using chkconfig.



# chkconfig --add dom
# chkconfig --list dom
dom 0:off 1:off 2:off 3:on 4:on 5:on 6:off


chkconfig creates a bunch of symbolic links to the /etc/init.d/dom.



# find /etc/rc* -name *dom

/etc/rc.d/rc5.d/S95dom
/etc/rc.d/rc6.d/K05dom
/etc/rc.d/rc3.d/S95dom
/etc/rc.d/rc1.d/K05dom
/etc/rc.d/rc4.d/S95dom
/etc/rc.d/rc0.d/K05dom
/etc/rc.d/init.d/dom
/etc/rc.d/rc2.d/K05dom


The service can be stopped & started manually:



# service dom restart
Stopping dom:
Starting dom:


So far all of this is good.



When I bootup into initlevel 3 then the 'start' (/etc/rc.d/rc3.d/S95dom) gets called:



atd: [ OK ]
Starting dom:
Starting perfmon: [ OK ]


However, when I shutdown (runlevel 6) the 'kill' (/etc/rc.d/rc6.d/K05dom) is not called.



INIT: Switching to runlevel: 6
INIT: Sending processes the TERM signal
Stopping atd: [ OK ]
Stopping perfmon: [ OK ]


It should have been stopped just after atd (05).



Have I misunderstood something ? How can I debug this ?



[On request, I have moved this question over from:
https://stackoverflow.com/questions/48106013/linux-initd-kill-script-not-being-called-at-runlevel-6-shutdown ]







share|improve this question




















  • You should have flagged it for migration on SO, which helps to avoid cross-posts.
    – nohillside
    Jan 5 at 18:46














up vote
0
down vote

favorite












I'm confused.
I thought i knew how the Linux init scripts worked, and it seems i do not.
For reference I'm working on a slightly elderly CentOS5.7.



I have written this script which basically does nothing other then print messages:



# cat /etc/init.d/dom 

#!/bin/bash
#
# chkconfig: 345 95 5
# description: NOP test
# processname: dom

# Source function library.
. /etc/init.d/functions


RETVAL=0
prog="dom"

start()
echo -n $"Starting $prog: "
echo
return $RETVAL


stop()
echo -n $"Stopping $prog: "
echo
return $RETVAL


restart()
stop
start


reload()
restart


status_at()
echo "OK"


case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart)
restart
;;
condrestart)
restart
;;
status)
status_at
;;
*)
echo $"Usage: $0 start"
exit 1
esac

exit $?
exit $RETVAL


Once I copied it into /etc/init.d/ the I added it using chkconfig.



# chkconfig --add dom
# chkconfig --list dom
dom 0:off 1:off 2:off 3:on 4:on 5:on 6:off


chkconfig creates a bunch of symbolic links to the /etc/init.d/dom.



# find /etc/rc* -name *dom

/etc/rc.d/rc5.d/S95dom
/etc/rc.d/rc6.d/K05dom
/etc/rc.d/rc3.d/S95dom
/etc/rc.d/rc1.d/K05dom
/etc/rc.d/rc4.d/S95dom
/etc/rc.d/rc0.d/K05dom
/etc/rc.d/init.d/dom
/etc/rc.d/rc2.d/K05dom


The service can be stopped & started manually:



# service dom restart
Stopping dom:
Starting dom:


So far all of this is good.



When I bootup into initlevel 3 then the 'start' (/etc/rc.d/rc3.d/S95dom) gets called:



atd: [ OK ]
Starting dom:
Starting perfmon: [ OK ]


However, when I shutdown (runlevel 6) the 'kill' (/etc/rc.d/rc6.d/K05dom) is not called.



INIT: Switching to runlevel: 6
INIT: Sending processes the TERM signal
Stopping atd: [ OK ]
Stopping perfmon: [ OK ]


It should have been stopped just after atd (05).



Have I misunderstood something ? How can I debug this ?



[On request, I have moved this question over from:
https://stackoverflow.com/questions/48106013/linux-initd-kill-script-not-being-called-at-runlevel-6-shutdown ]







share|improve this question




















  • You should have flagged it for migration on SO, which helps to avoid cross-posts.
    – nohillside
    Jan 5 at 18:46












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm confused.
I thought i knew how the Linux init scripts worked, and it seems i do not.
For reference I'm working on a slightly elderly CentOS5.7.



I have written this script which basically does nothing other then print messages:



# cat /etc/init.d/dom 

#!/bin/bash
#
# chkconfig: 345 95 5
# description: NOP test
# processname: dom

# Source function library.
. /etc/init.d/functions


RETVAL=0
prog="dom"

start()
echo -n $"Starting $prog: "
echo
return $RETVAL


stop()
echo -n $"Stopping $prog: "
echo
return $RETVAL


restart()
stop
start


reload()
restart


status_at()
echo "OK"


case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart)
restart
;;
condrestart)
restart
;;
status)
status_at
;;
*)
echo $"Usage: $0 start"
exit 1
esac

exit $?
exit $RETVAL


Once I copied it into /etc/init.d/ the I added it using chkconfig.



# chkconfig --add dom
# chkconfig --list dom
dom 0:off 1:off 2:off 3:on 4:on 5:on 6:off


chkconfig creates a bunch of symbolic links to the /etc/init.d/dom.



# find /etc/rc* -name *dom

/etc/rc.d/rc5.d/S95dom
/etc/rc.d/rc6.d/K05dom
/etc/rc.d/rc3.d/S95dom
/etc/rc.d/rc1.d/K05dom
/etc/rc.d/rc4.d/S95dom
/etc/rc.d/rc0.d/K05dom
/etc/rc.d/init.d/dom
/etc/rc.d/rc2.d/K05dom


The service can be stopped & started manually:



# service dom restart
Stopping dom:
Starting dom:


So far all of this is good.



When I bootup into initlevel 3 then the 'start' (/etc/rc.d/rc3.d/S95dom) gets called:



atd: [ OK ]
Starting dom:
Starting perfmon: [ OK ]


However, when I shutdown (runlevel 6) the 'kill' (/etc/rc.d/rc6.d/K05dom) is not called.



INIT: Switching to runlevel: 6
INIT: Sending processes the TERM signal
Stopping atd: [ OK ]
Stopping perfmon: [ OK ]


It should have been stopped just after atd (05).



Have I misunderstood something ? How can I debug this ?



[On request, I have moved this question over from:
https://stackoverflow.com/questions/48106013/linux-initd-kill-script-not-being-called-at-runlevel-6-shutdown ]







share|improve this question












I'm confused.
I thought i knew how the Linux init scripts worked, and it seems i do not.
For reference I'm working on a slightly elderly CentOS5.7.



I have written this script which basically does nothing other then print messages:



# cat /etc/init.d/dom 

#!/bin/bash
#
# chkconfig: 345 95 5
# description: NOP test
# processname: dom

# Source function library.
. /etc/init.d/functions


RETVAL=0
prog="dom"

start()
echo -n $"Starting $prog: "
echo
return $RETVAL


stop()
echo -n $"Stopping $prog: "
echo
return $RETVAL


restart()
stop
start


reload()
restart


status_at()
echo "OK"


case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart)
restart
;;
condrestart)
restart
;;
status)
status_at
;;
*)
echo $"Usage: $0 start"
exit 1
esac

exit $?
exit $RETVAL


Once I copied it into /etc/init.d/ the I added it using chkconfig.



# chkconfig --add dom
# chkconfig --list dom
dom 0:off 1:off 2:off 3:on 4:on 5:on 6:off


chkconfig creates a bunch of symbolic links to the /etc/init.d/dom.



# find /etc/rc* -name *dom

/etc/rc.d/rc5.d/S95dom
/etc/rc.d/rc6.d/K05dom
/etc/rc.d/rc3.d/S95dom
/etc/rc.d/rc1.d/K05dom
/etc/rc.d/rc4.d/S95dom
/etc/rc.d/rc0.d/K05dom
/etc/rc.d/init.d/dom
/etc/rc.d/rc2.d/K05dom


The service can be stopped & started manually:



# service dom restart
Stopping dom:
Starting dom:


So far all of this is good.



When I bootup into initlevel 3 then the 'start' (/etc/rc.d/rc3.d/S95dom) gets called:



atd: [ OK ]
Starting dom:
Starting perfmon: [ OK ]


However, when I shutdown (runlevel 6) the 'kill' (/etc/rc.d/rc6.d/K05dom) is not called.



INIT: Switching to runlevel: 6
INIT: Sending processes the TERM signal
Stopping atd: [ OK ]
Stopping perfmon: [ OK ]


It should have been stopped just after atd (05).



Have I misunderstood something ? How can I debug this ?



[On request, I have moved this question over from:
https://stackoverflow.com/questions/48106013/linux-initd-kill-script-not-being-called-at-runlevel-6-shutdown ]









share|improve this question











share|improve this question




share|improve this question










asked Jan 5 at 18:22









dom

1




1











  • You should have flagged it for migration on SO, which helps to avoid cross-posts.
    – nohillside
    Jan 5 at 18:46
















  • You should have flagged it for migration on SO, which helps to avoid cross-posts.
    – nohillside
    Jan 5 at 18:46















You should have flagged it for migration on SO, which helps to avoid cross-posts.
– nohillside
Jan 5 at 18:46




You should have flagged it for migration on SO, which helps to avoid cross-posts.
– nohillside
Jan 5 at 18:46















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f415046%2flinux-initd-kill-script-not-being-called-at-runlevel-6-shutdown%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f415046%2flinux-initd-kill-script-not-being-called-at-runlevel-6-shutdown%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)