SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
In rc.K and rc.6 is the command rc.local_shutdown stop. The rc.local_shutdown script is user-created rather than a tradtional rc.d script. What purpose does the stop parameter serve? Should the command just be rc.local_shutdown?
In rc.K and rc.6 is the command rc.local_shutdown stop. The rc.local_shutdown script is user-created rather than a tradtional rc.d script. What purpose does the stop parameter serve? Should the command just be rc.local_shutdown?
I had the same question awhile ago and found this. Pretty succinct answer in there.
# Run any local shutdown scripts:
if [ -x /etc/rc.d/rc.local_shutdown ]; then
/etc/rc.d/rc.local_shutdown stop $shutdown_command
fi
Reason? I need to check how r.6 was called in rc.local_shutdown.
That does not make sense to me. The rc.6 script calls rc.local_shutdown, not the other way round. The "stop" parameter to rc.local_shutdown script can be used to inform any script you call inside rc.local_shutdown, that the computer is shutting down. I see no point in adding $shutdown_command if "stop" is already provided.
I asked the original question because I test which way the rc.local_shutdown script is called. Yes, that is my own local customization. Yes, that means I am "on my own" to deal with my local customization.
In the past with rc.K and rc.6 I deleted the 'stop' parameter. I had forgotten I had deleted the parameter long ago. I was testing Current and "rediscovered" the parameter. As my rc.local_shutdown does not test for the 'stop' parameter, I saw an unusual stdout when tinkering with Current. Hardly a show stopper or breath gasper, just that I noticed.
After posting I modified my rc.local_shutdown to test for the 'stop' parameter.
As referenced in the other thread, I apppreciate that having the 'stop' parameter in rc.K and rc.6 is a clever hack, but the parameter is inconsistent with expectations of the rc scripts. The observation is not worth jumping up and down about like Yosemite Sam though.
That does not make sense to me. The rc.6 script calls rc.local_shutdown, not the other way round. The "stop" parameter to rc.local_shutdown script can be used to inform any script you call inside rc.local_shutdown, that the computer is shutting down. I see no point in adding $shutdown_command if "stop" is already provided.
I guess I could have said it better. Yes rc.6 calls rc.local_shutdown. The value of shutdown_command is set to either "halt" or "reboot" in rc.6. I need to determine if the system is shutting down or rebooting and pass it to rc.local_shutdown.
Last edited by chrisretusn; 04-26-2018 at 12:03 PM.
If you are asking me, only a few things. I did not post previously but I check if the system is suspending or hibernating. I run some synchronizing scripts. When I power down a system on the home LAN I run the scripts but not when rebooting. I check if the system is connected to the home LAN, such as the laptop. If not then don't bother running the scripts. I have some systems on the LAN send a remote notification when powering down. On client systems I run a remote-shutdown script that connects by SSH to the server and creates an at scheduler job to power down -- when no other systems remain online the server powers down too. I run certain tasks when not in run level 1, such as running non-stock rc.d scripts to stop processes.
Possibly overkill, but keeps me entertained and seems to keep me off the streets.
What would you execute differently when rebooting compared to shutting down?
I have a problem with my motherboard clock. Here is the rc.local_shutdown part for that.
Code:
# Time is not being set correctly after long shutdowns
# Add a shutdown flag to /etc so it can be tested for on boot up.
# Added a second parameter to rc.6 to pass $command to rc.local_shutdown
if [ "$2" = "halt" ]; then
touch /etc/shutdown
fi
In rc.local I have:
Code:
# Motherboard is not keeping the time.
# Set the time from a NTP server if system was last shutdown.
# Note: Added code to rc.6 to add file checked for.
if [ -f /etc/shutdown ]; then
echo "System was shutdown. Getting time from NTP pool server"
# Remove the shutdown file
/bin/rm /etc/shutdown
# Stop the NTP deamon
/etc/rc.d/rc.ntpd stop
# Get the time
echo "Setting the time: /usr/sbin/ntpdate asia.pool.ntp.org"
/usr/sbin/ntpdate asia.pool.ntp.org
# Restart the NTP deamon
/etc/rc.d/rc.ntpd start
fi
Always looking for better ways to do things.
Last edited by chrisretusn; 04-27-2018 at 10:57 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.