Manually start Samba on Kongmod build

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2
Author Message
mkaand
DD-WRT User


Joined: 06 Jan 2008
Posts: 307
Location: Istanbul

PostPosted: Mon Sep 11, 2017 14:49    Post subject: Reply with quote
Yes you're right. Currently my samba enabled on GUI. But it doesn't startup always after reboot. With your fix I have no issue with that. Thanks again!
_________________
Kaan's World | @mkaand | PLEX Archive | Trakt.tv
Sponsor
dragonC
DD-WRT User


Joined: 23 May 2015
Posts: 272

PostPosted: Mon Sep 11, 2017 17:27    Post subject: Reply with quote
mkaand wrote:
Yes you're right. Currently my samba enabled on GUI. But it doesn't startup always after reboot. With your fix I have no issue with that. Thanks again!


You're very welcome.
mkaand
DD-WRT User


Joined: 06 Jan 2008
Posts: 307
Location: Istanbul

PostPosted: Sun Sep 17, 2017 11:41    Post subject: Reply with quote
Today I rebooted my router, and my samba network share didn't work. I examine your script. I copied your code to test.sh just added echo "smbd" and echo "nmbd" before sleep line. When I run your code, I saw 6 times nmbd on shell and samba didn't start properly. I run this command:

stopservice samba3
sh /tmp/test.sh

Result:
smbd
nmbd

and samba started properly.

So I added "stopservice samba3" on top of your startup code. Now looks like fixed. In my case, smbd was working but nmbd didn't start at the startup. Final code for Kong's build:

Quote:

stopservice samba3
counter=0
while ( ! (ps | grep -q [s]mbd) ); do
if [[ $counter -gt 5 ]]; then
exit 1
fi
/usr/sbin/smbd -D --configfile=/tmp/smb.conf
counter=$((counter+1))
sleep 15
done

counter=0
while ( ! (ps | grep -q [n]mbd) ); do
if [[ $counter -gt 5 ]]; then
exit 1
fi
/usr/sbin/nmbd -D --configfile=/tmp/smb.conf
counter=$((counter+1))
sleep 15
done

_________________
Kaan's World | @mkaand | PLEX Archive | Trakt.tv
dragonC
DD-WRT User


Joined: 23 May 2015
Posts: 272

PostPosted: Sun Sep 17, 2017 20:28    Post subject: Reply with quote
mkaand wrote:
Today I rebooted my router, and my samba network share didn't work. I examine your script. I copied your code to test.sh just added echo "smbd" and echo "nmbd" before sleep line. When I run your code, I saw 6 times nmbd on shell and samba didn't start properly. I run this command:

stopservice samba3
sh /tmp/test.sh

Result:
smbd
nmbd

and samba started properly.

So I added "stopservice samba3" on top of your startup code. Now looks like fixed. In my case, smbd was working but nmbd didn't start at the startup. Final code for Kong's build:

Quote:

stopservice samba3
counter=0
while ( ! (ps | grep -q [s]mbd) ); do
if [[ $counter -gt 5 ]]; then
exit 1
fi
/usr/sbin/smbd -D --configfile=/tmp/smb.conf
counter=$((counter+1))
sleep 15
done

counter=0
while ( ! (ps | grep -q [n]mbd) ); do
if [[ $counter -gt 5 ]]; then
exit 1
fi
/usr/sbin/nmbd -D --configfile=/tmp/smb.conf
counter=$((counter+1))
sleep 15
done


Interesting. Did you by any chance still have Samba enabled via the GUI? I think they may conflict with each other. In my case Samba is completely disabled in the GUI - they are only managed by the script alone
mkaand
DD-WRT User


Joined: 06 Jan 2008
Posts: 307
Location: Istanbul

PostPosted: Mon Sep 18, 2017 1:01    Post subject: Reply with quote
In my case samba enabled on GUI, because it is easy to create config (set settings) (habits).
_________________
Kaan's World | @mkaand | PLEX Archive | Trakt.tv
dragonC
DD-WRT User


Joined: 23 May 2015
Posts: 272

PostPosted: Mon Sep 18, 2017 2:28    Post subject: Reply with quote
mkaand wrote:
In my case samba enabled on GUI, because it is easy to create config (set settings) (habits).


I see. I haven't run into this before. Maybe the GUI is indeed a factor -- it probably tries to spawn another smbd/nmbd pairs and conflicts. I recall having OpenVPN enabled in GUI and starting manually at CLI caused my own launch to quit sporadically before. Now I manage all my services in scripts
claudinei
DD-WRT User


Joined: 21 Mar 2009
Posts: 66

PostPosted: Sun May 19, 2019 16:39    Post subject: starting services smb from shell and his collateral effects Reply with quote
Hello Guys

I would like to point out that if u disable the service samba in to the GUI u may not able to start it w/ shell script since the copy of the configuration sbm.conf located on /tmp/ will not be there....

so that meas if u use any shell to star samba, u will have 2 services running at the same time.

I mentioned that because I read on this pots an recommendation to disable the SAMBA on GUI to avoid 2 concurrent process.

Test on ---> DD-WRT v3.0-r39715M kongac (05/09/19)

RT-AC3200

_________________
RT-AC68U
RT-AC3200
TL-MR3020
TL-WDR3600 v1
Dr_K
DD-WRT User


Joined: 23 Mar 2018
Posts: 445

PostPosted: Sun May 19, 2019 18:23    Post subject: Reply with quote
I have been commenting on these similar topics for quite some time now...
Supprised searches still bring back these dated overly coded "solutions" that don't always work as expected..

If you just add to a startup script generated through the GUI...or however you prefer...
Code:
sleep 30
stopservice samba3
startservice samba3

Works every time, after every reboot..
Tested on several routers using numerous different builds with several different branded HDs over the years.

The devs say "not needed, works for me". As aparently this isn't an issue when using "brand new" HD's?

If they would just load samba last it would no doubt work for everyone all the time ¯\_(ツ)_/¯


I see this has been mentioned on the first page....but got buried in a page worth of code that doesn't always work?
So I see no harm in it being repeated.

_________________
Location 1
R7800- DD-WRT v3.0-r53562 (10/03/23) Gateway
WNDR3400v1 DD-WRT v3.0-r35531_mega-nv64k (03/26/18 ) Access Point
WRT160Nv3 DD-WRT ?v3?.0-r35531 mini (03/26/18 ) Access Point
WRT54GSv5 DD-WRT v24-r33555_micro_generic (10/20/17) Repeater
Location 2
R7800- DD-WRT v3.0-r51855 (02/25/23) Gateway
R6300v2- DD-WRT v3.0-r50671 (10-26-22) Access Point
WNDR3700v2 DD-WRT v3.0-r35531 std (03/26/18 ) Access Point
E1200 v2 DD-WRT v3.0-r35531 mega-nv64k (03/26/18 ) Gateway(for trivial reasons)
RBWAPG-5HACT2HND-BE RouterOS-v6.46.4 (2/21/20) Outdoor Access Point
2x RBSXTG-5HPACD RouterOS-v6.46.4 (2/21/20) PTP Bridge 866.6Mbps-1GbpsLAN
Location 3
2x R7000- DD-WRT v3.0-r50671 (10/26/22) Access Points
2x RBWAPG-60AD RouterOS-v6.45.9 (04/30/20) PTP Bridge 2.3Gbps-1GbpsLAN
2x RBSXTsqG-5acD RouterOS-v6.49.7 (10/14/22) PTP Bridge 866.6Mbps-1GbpsLAN

Thank You BrainSlayer for ALL that you do & have done, also to "most" everyone here that shares their knowledge
Goto page Previous  1, 2 Display posts from previous:    Page 2 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum