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

Clash 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 ]
linux sysvinit
add a comment |Â
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 ]
linux sysvinit
You should have flagged it for migration on SO, which helps to avoid cross-posts.
â nohillside
Jan 5 at 18:46
add a comment |Â
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 ]
linux sysvinit
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 ]
linux sysvinit
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
add a comment |Â
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
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
You should have flagged it for migration on SO, which helps to avoid cross-posts.
â nohillside
Jan 5 at 18:46