[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Who is altering my hostname?



Hi,

> Is is possible that this change of hostnames is somehow enfored by the
> virtualization? (Virtuozzo)

Yes, Virtuozzo is known to do such things. I use the attached script in
/etc/init.d with appropriate links in /etc/rc*.d (run the script very
early in the boot process).

Regards,
  Joachim
#!/bin/sh

. /lib/init/vars.sh
. /lib/lsb/init-functions

case "$1" in

  start)
		[ "$VERBOSE" != no ] && log_action_begin_msg "local workarounds"
		if [ -f /etc/hostname.real ]; then
			cp -a /etc/hostname.real /etc/hostname
			hostname `cat /etc/hostname`
			uname -snrvm > /var/run/motd
			[ -f /etc/motd.tail ] && cat /etc/motd.tail >> /var/run/motd
		fi
		[ "$VERBOSE" != no ] && log_action_end_msg 0
		;;

  stop)
		[ "$VERBOSE" != no ] && log_action_begin_msg "local workarounds"
		cp -a /etc/hostname /etc/hostname.real
		[ "$VERBOSE" != no ] && log_action_end_msg 0
		;;

  restart|force-reload)
		;;

  *)
		echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
		exit 3
		;;
		
esac

Reply to: