I'm having trouble changing the machine name programmatically on Samba 4 (running under systemd). There's no "netbios name" option in smb.conf, so I'm relying on it using the hostname. Here's what I'm doing: 1) Call sethostname() with the new name. 2) Write the same name into /etc/hostname, to make it nonvolatile. 3) Read a decimal number from /var/run/smbd.pid. 4) Send SIGHUP to that process. Nothing happens. If I reboot, then the new name is announced on the network. How do I get it to do this without rebooting the entire system? -- Ciao, Paul D. DeRocco Paul mailto:pderocco at ix.netcom.com
Am 23.02.2016 um 00:35 schrieb Paul D. DeRocco:> I'm having trouble changing the machine name programmatically on Samba 4 > (running under systemd). There's no "netbios name" option in smb.conf, so > I'm relying on it using the hostname. Here's what I'm doing: > > 1) Call sethostname() with the new name. > > 2) Write the same name into /etc/hostname, to make it nonvolatile. > > 3) Read a decimal number from /var/run/smbd.pid. > > 4) Send SIGHUP to that process. > > Nothing happens. If I reboot, then the new name is announced on the > network. How do I get it to do this without rebooting the entire system?just restart the samba server instead only reload? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: OpenPGP digital signature URL: <http://lists.samba.org/pipermail/samba/attachments/20160223/66286913/signature.sig>
> From: Reindl Harald > > just restart the samba server instead only reload?But how do you do that in C? Frankly, I don't even know how to do that from the command line. This is an embedded system without a lot of high-level utilities like you get on Ubuntu. -- Ciao, Paul D. DeRocco Paul mailto:pderocco at ix.netcom.com
> > Paul D. DeRocco: > > > > I'm having trouble changing the machine name > > programmatically on Samba 4 > > (running under systemd). There's no "netbios name" option > > in smb.conf, so > > I'm relying on it using the hostname. Here's what I'm doing: > > > > 1) Call sethostname() with the new name. > > > > 2) Write the same name into /etc/hostname, to make it nonvolatile. > > > > 3) Read a decimal number from /var/run/smbd.pid. > > > > 4) Send SIGHUP to that process. > > > > Nothing happens. If I reboot, then the new name is announced on the > > network. How do I get it to do this without rebooting the > > entire system? > > From: Reindl Harald > > just restart the samba server instead only reload?Well, it turns out restarting the server doesn't seem to work either. Nor does stopping it, waiting awhile, and restarting it. Adding the "netbios name" option in smb.conf doesn't help. If I change the name, only rebooting seems to make it visible on the network. Does anyone know enough about how this works to tell me if it's possible to get Samba to inform the network of the new name without a reboot? -- Ciao, Paul D. DeRocco Paul mailto:pderocco at ix.netcom.com
Uh... just add : netbios name = PC_NAME> -----Oorspronkelijk bericht----- > Van: samba [mailto:samba-bounces at lists.samba.org] Namens Paul D. DeRocco > Verzonden: dinsdag 23 februari 2016 0:35 > Aan: Samba list > Onderwerp: [Samba] Change machine name without a reboot? > > I'm having trouble changing the machine name programmatically on Samba 4 > (running under systemd). There's no "netbios name" option in smb.conf, so > I'm relying on it using the hostname. Here's what I'm doing: > > 1) Call sethostname() with the new name. > > 2) Write the same name into /etc/hostname, to make it nonvolatile. > > 3) Read a decimal number from /var/run/smbd.pid. > > 4) Send SIGHUP to that process. > > Nothing happens. If I reboot, then the new name is announced on the > network. How do I get it to do this without rebooting the entire system? > > -- > > Ciao, Paul D. DeRocco > Paul mailto:pderocco at ix.netcom.com > > > -- > To unsubscribe from this list go to the following URL and read the > instructions: https://lists.samba.org/mailman/options/samba
Systemd service files are generally coming with packages. This means these files can be overwritten by some system update if this updates also your Samba packages (note: I never had nor tested that behaviour with Samba packages, but it happens for other packages). 2016-02-23 8:39 GMT+01:00 L.P.H. van Belle <belle at bazuin.nl>:> Uh... just add : > > netbios name = PC_NAME > > > > -----Oorspronkelijk bericht----- > > Van: samba [mailto:samba-bounces at lists.samba.org] Namens Paul D. DeRocco > > Verzonden: dinsdag 23 februari 2016 0:35 > > Aan: Samba list > > Onderwerp: [Samba] Change machine name without a reboot? > > > > I'm having trouble changing the machine name programmatically on Samba 4 > > (running under systemd). There's no "netbios name" option in smb.conf, so > > I'm relying on it using the hostname. Here's what I'm doing: > > > > 1) Call sethostname() with the new name. > > > > 2) Write the same name into /etc/hostname, to make it nonvolatile. > > > > 3) Read a decimal number from /var/run/smbd.pid. > > > > 4) Send SIGHUP to that process. > > > > Nothing happens. If I reboot, then the new name is announced on the > > network. How do I get it to do this without rebooting the entire system? > > > > -- > > > > Ciao, Paul D. DeRocco > > Paul mailto:pderocco at ix.netcom.com > > > > > > -- > > To unsubscribe from this list go to the following URL and read the > > instructions: https://lists.samba.org/mailman/options/samba > > > > -- > To unsubscribe from this list go to the following URL and read the > instructions: https://lists.samba.org/mailman/options/samba >