- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Redhat chkconfig script: does the 'stop' ever ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-28-2007 10:25 PM
тАО03-28-2007 10:25 PM
It seems that the "stop" part of some scripts listed in chkconf on my redhat AS 4.4 are never executed (but some are).
To show this, i created a test script, /etc/init.d/leo :
#!/bin/bash
# chkconfig: 345 99 01
# description: leonardo test
# source function library
. /etc/init.d/functions
case "$1" in
start)
echo -n "starting leonardo"
echo "$(date): $1" >/tmp/leo_start
;;
stop)
echo -n "stopping leonardo"
echo "$(date): $1" >/tmp/leo_stop
;;
*)
echo -n "others leonardo"
echo "$(date): $1" >/tmp/leo_others
exit 1
esac
exit 0
#########
Then I did: chmod 755, chown root:root,
chkconfig --add leo.
ll /etc/rc?.d/*leo*
.../etc/rc6.d/K01leonardo -> ../init.d/leonardo
.../etc/rc5.d/S99leonardo -> ../init.d/leonardo
.../etc/rc4.d/S99leonardo -> ../init.d/leonardo
.../etc/rc3.d/S99leonardo -> ../init.d/leonardo
.../etc/rc1.d/K01leonardo -> ../init.d/leonardo
.../etc/rc0.d/K01leonardo -> ../init.d/leonardo
Also 'chkconfig --list leonardo' give the expected output.
This script works fine when is executed from the command line with start|stop|SmthingElse parameters.
But after a reboot of the server, I just can find a /tmp/leo_start file, and a "starting leo" line in /var/log/messages, but NEVER a /tmp/leo_stop or a "stopping leo" message, nor a mail for root, or smthing like that.
So it seems that the script is never executed by the system with a "stop" parameter when the server is rebooted. And that the K01leonardo links are unuseful...
What am I missing???
Many thanks in advance to everybody.
Leonardo.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-28-2007 11:45 PM
тАО03-28-2007 11:45 PM
Re: Redhat chkconfig script: does the 'stop' ever run?
I'd recomend you to use another folder for your tests.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2007 12:46 AM
тАО03-29-2007 12:46 AM
Re: Redhat chkconfig script: does the 'stop' ever run?
Thanks anyway.
L.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2007 01:01 AM
тАО03-29-2007 01:01 AM
Re: Redhat chkconfig script: does the 'stop' ever run?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2007 01:10 AM
тАО03-29-2007 01:10 AM
Re: Redhat chkconfig script: does the 'stop' ever run?
/sbin/reboot is a link to halt.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2007 01:18 AM
тАО03-29-2007 01:18 AM
Re: Redhat chkconfig script: does the 'stop' ever run?
usually when you use chkconfig, the script is copied into /etc/init.d and configured for start/stop into rc.x level.
Check if into /etc/init.d your script is present.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2007 01:30 AM
тАО03-29-2007 01:30 AM
Re: Redhat chkconfig script: does the 'stop' ever run?
Sorry
when you reboot the server, the tmp folder became empty.
When you shutdown the system, it go into runlevel 0 and have to kill all the process.
Your script write into tmp the "leo_stop" but this is erased at reboot, infact you can find only the start.
Try to put your start/stop result into another folder and reboot, i'm sure you can find all.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2007 02:05 AM
тАО03-29-2007 02:05 AM
Re: Redhat chkconfig script: does the 'stop' ever run?
file creation changed to /root ; and anyway /tmp is not emptyed at boot, so it seems. And yes, the script "leo" is in /etc/init.d.
But no good news after the reboot.
Some other suggestions?
Many thanks.
Leonardo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2007 02:06 AM
тАО03-29-2007 02:06 AM
Re: Redhat chkconfig script: does the 'stop' ever run?
what happens if you execute:
/etc/rc0.d/K01leonardo ?
I suppose it should bring you closer to the solution, i.e. if it'll create the /tmp/leo_stop file, then (unless it's a bug of course) you should consider rewriting your script to create a file in another folder.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2007 02:28 AM
тАО03-29-2007 02:28 AM
Re: Redhat chkconfig script: does the 'stop' ever run?
Running as root
/etc/rc0.d/K01leonardo stop
works fine, and create the /root/leo_stop file (as the "new" script version has /tmp changed in /root).
But after the 'shutdown -r now' command is completed, in /root just the leo_start exists. Nothing changed, no leo_stop file!
L.