diff -Nur e-smith-base-5.8.0.bz9631.old/root/etc/e-smith/events/actions/set-hostname e-smith-base-5.8.0.bz9631.new/root/etc/e-smith/events/actions/set-hostname --- e-smith-base-5.8.0.bz9631.old/root/etc/e-smith/events/actions/set-hostname 2005-11-21 05:28:05.000000000 +0100 +++ e-smith-base-5.8.0.bz9631.new/root/etc/e-smith/events/actions/set-hostname 2016-07-02 21:04:00.777373320 +0200 @@ -1,7 +1,7 @@ -#!/bin/sh +#!/usr/bin/perl #---------------------------------------------------------------------- -# copyright (C) 1999-2005 Mitel Networks Coporation +# copyright (C) 2016 Koozali SME Server # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,5 +18,14 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #---------------------------------------------------------------------- +use esmith::ConfigDB; -exec /bin/hostname -F /etc/HOSTNAME +my $db = esmith::ConfigDB->open_ro() or die 'cannot open the database'; +my $SystemName = $db->get_value('SystemName'); +my $DomainName = $db->get_value('DomainName'); + +#set the command +my $command = "exec /bin/hostnamectl set-hostname $SystemName.$DomainName"; + +open EXEC, "$command |" or die "cannot set hostname: $!"; +close EXEC;