LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-25-2021, 08:06 AM   #1
vineetmehta
LQ Newbie
 
Registered: Apr 2019
Posts: 11

Rep: Reputation: Disabled
rc.dnsmasq restart messages


Hi friends,

I am using Slackware current, shouldn't the 'rc.dnsmasq' not display stop and start message when we restart the service?

It would be informative and useful to the user.

Thank you.
 
Old 04-25-2021, 11:11 AM   #2
elcore
Senior Member
 
Registered: Sep 2014
Distribution: Slackware
Posts: 1,754

Rep: Reputation: Disabled
Yes, very interesting, don't see the benefit personally, but feel free to write the thing and propose a patch.
Problem's that the manual notes different signals doing very different things, for example:

Code:
       When it receives a SIGHUP, dnsmasq clears its cache and then re-loads /etc/hosts and /etc/ethers and any file given by --dhcp-hostsfile, --dhcp-hostsdir,  --dhcp-optsfile,
       --dhcp-optsdir,  --addn-hosts  or  --hostsdir.   The  DHCP  lease  change  script  is  called  for  all  existing  DHCP  leases.  If  --no-poll is set SIGHUP also re-reads
       /etc/resolv.conf.  SIGHUP does NOT re-read the configuration file.
For this reason I don't use the rc functions and just send a SIGHUP, my opinion is that rc.dnsmasq restart should send a SIGHUP, but then someone else may expect it to reload a config file..
Real fix for this situation would be to make multiple new functions in rc.dnsmasq, one for each supported signal, and only then make it echo a different message for each of them.

If rc.dnsmasq restart just kills the server and starts another one, the message is correct.
If you don't agree, just make it echo whatever message you want on restart function, it's easy enough.
 
Old 04-25-2021, 11:41 AM   #3
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,842

Rep: Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507
'/etc/rc.d/rc.dnsmasq stop' (or restart) now kills any program called dnsmasq. Let's kill the process with PID in /var/run/dnsmasq.pid, if it's called dnsmasq:

Code:
--- rc.dnsmasq.orig     2006-01-31 22:51:05.000000000 +0200
+++ rc.dnsmasq  2021-04-25 19:31:19.399115050 +0300
@@ -11,7 +11,10 @@
 
 # Stop dnsmasq:
 dnsmasq_stop() {
-  killall dnsmasq
+  if pgrep -l -F /var/run/dnsmasq.pid 2>/dev/null | grep -q dnsmasq; then
+    echo "Stopping dnsmasq."
+    pkill -F /var/run/dnsmasq.pid 2>/dev/null
+  fi
 }
 
 # Restart dnsmasq:
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] samba needs a restart after a system restart dimm0k Slackware 16 12-04-2016 03:34 PM
[SOLVED] Have to restart network on restart? sapslaj Linux - Networking 5 06-30-2012 02:02 PM
Ubuntu 9.10 - "Restart" option just restarts Ubuntu, doesn't restart PC tensigh Linux - Laptop and Netbook 5 03-02-2011 10:47 AM
How do I set the regulatory daemon to restart when I restart the network service? zahadumy Linux - Networking 0 11-05-2006 11:24 AM
dnsmasq. syslog and console messages kevmccor Slackware 2 11-13-2005 06:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration