LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   rc.6 and rc.local_shutdown (http://www.linuxquestions.org/questions/slackware-14/rc-6-and-rc-local_shutdown-4175456072/)

markush 03-29-2013 06:21 PM

rc.6 and rc.local_shutdown
 
Hi,

I'm installing postgresql from slackbuilds.org.

The README-file says that one should put the following lines into /etc/rc.local_shutdown
Code:

# Stop postgres
        if [ -x /etc/rc.d/rc.postgresql ]; then
                /etc/rc.d/rc.postgresql stop
        fi

Since we don't have this file /etc/rc.d/rc.local_shutdown in Slackware I examinded the /etc/rc.d/rc.6 file in order to find out if I could put the code which stops the database there. I found the following lines in /etc/rc.d/rc.local_shutdown
Code:

# Run any local shutdown scripts:
if [ -x /etc/rc.d/rc.local_shutdown ]; then
  /etc/rc.d/rc.local_shutdown stop
fi

This seems odd to me. I think that the script rc.local_shutdown should be called without a parameter (without stop), like rc.local?

I suppose that "stop" doesn't do anything, but probably it should be removed.

I've now created a rc.local_shutdown and removed the stop from rc.6

Markus

GazL 03-29-2013 06:26 PM

Quote:

Originally Posted by markush (Post 4921310)
Hi,

I'm installing postgresql from slackbuilds.org.

I'd wait a few days:
http://lwn.net/Articles/545172/


If nothing makes reference to $1 in the shutdown script then it's not doing any harm, but yes, passing 'stop' to a shutdown script does seem a little redundant. :)

markush 03-29-2013 06:32 PM

Thanks for the quick reply,
Quote:

Originally Posted by GazL (Post 4921314)
I'd wait a few days:
http://lwn.net/Articles/545172/
...

I've read this on Twitter, but I'll use the database only at home for learning.
Quote:

...
If nothing makes reference to $1 in the shutdown script then it's not doing any harm, but yes, passing 'stop' to a shutdown script does seem a little redundant. :)
Yes, it doesn't any harm, but I wanted to verify that I make no mistake when I delete "stop".

Markus

GazL 03-29-2013 06:42 PM

I suspect the only reason the 'stop' is there is because that section of code was a cut/paste from one of the ones above it. I wouldn't worry.

volkerdi 03-29-2013 06:50 PM

It calls it with $1 == stop because

1) it doesn't hurt
2) if you only have one shutdown script that you're calling, you could actually make a symlink rc.local_shutdown -> rc.postgresql and be good to go.

markush 03-29-2013 06:58 PM

Quote:

Originally Posted by volkerdi (Post 4921330)
It calls it with $1 == stop because

1) it doesn't hurt
2) if you only have one shutdown script that you're calling, you could actually make a symlink rc.local_shutdown -> rc.postgresql and be good to go.

Thanks Pat, I'll create a symlink.

I missed the point that the "stop" works on a symlink like
Code:

/etc/rc.d/rc.postgresql stop
Markus

GazL 03-29-2013 07:12 PM

Quote:

Originally Posted by volkerdi (Post 4921330)
It calls it with $1 == stop because

2) if you only have one shutdown script that you're calling, you could actually make a symlink rc.local_shutdown -> rc.postgresql and be good to go.

Sneaky. I would have never thought of that.
I like it. :)


All times are GMT -5. The time now is 11:40 PM.