[systemd-devel] Restarting nmb.service from within a program

Reindl Harald h.reindl at thelounge.net
Tue Nov 3 12:02:17 PST 2015



Am 03.11.2015 um 20:44 schrieb Paul D. DeRocco:
> I have a Yocto embedded system running a simple Samba 4 server, using
> systemd. I'm relying on the system hostname being the default netbios
> name, and I need to be able to change the hostname, and therefore the
> netbios name, from within my main application. I write the new hostname to
> /etc/hostname, and also call sethostname(), but in order for the change to
> take effect, the nmbd daemon (that is, nmb.service) needs to be restarted.
>
> Since systemd is managing this service, it seems I should be accomplishing
> this by telling systemd to restart the service. Is there a documented way
> to do this from within a program? There must be some way, since systemctl
> does it

and why don't you just call systemctl?

that's even from php scripts with exec() or passthru() a no brainer

-------------- 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.freedesktop.org/archives/systemd-devel/attachments/20151103/fcbc1ca8/attachment.sig>


More information about the systemd-devel mailing list