* Emit ip-up / ip-down events when we get or lose a DHCP lease.

* ntpd: start on ip-up, not when the network interfaces are up,
  otherwise it will fail because it can't find any servers right
  away.

svn path=/nixos/trunk/; revision=7461
This commit is contained in:
Eelco Dolstra 2006-12-22 17:28:25 +00:00
parent 617ebcbcce
commit f037f6fbd4
3 changed files with 22 additions and 4 deletions

View File

@ -52,6 +52,13 @@ import ../helpers/make-etc.nix {
target = "default/passwd"; target = "default/passwd";
} }
{ # Dhclient hooks for emitting ip-up/ip-down events.
source = pkgs.substituteAll {
src = ./etc/dhclient-exit-hooks;
inherit (pkgs) upstart;
};
target = "dhclient-exit-hooks";
}
] ]
# A bunch of PAM configuration files for various programs. # A bunch of PAM configuration files for various programs.

View File

@ -0,0 +1,10 @@
echo "$reason" >> /tmp/dhcp-exit
echo "$exit_status" >> /tmp/dhcp-exit
if test "$reason" = BOUND -o "$reason" = REBOOT; then
@upstart@/sbin/initctl emit ip-up
fi
if test "$reason" = EXPIRE -o "$reason" = RELEASE; then
@upstart@/sbin/initctl emit ip-down
fi

View File

@ -20,8 +20,9 @@ in
job = " job = "
description \"NTP daemon\" description \"NTP daemon\"
start on network-interfaces/started start on ip-up
stop on network-interfaces/stop stop on ip-down
stop on shutdown
start script start script
@ -34,12 +35,12 @@ start script
chown ${ntpUser} ${stateDir} chown ${ntpUser} ${stateDir}
date date
${ntp}/bin/ntpd -ddd -c ${config} -q -g ${ntp}/bin/ntpd -c ${config} -q -g
date date
end script end script
respawn ${ntp}/bin/ntpd -ddd -n -c ${config} respawn ${ntp}/bin/ntpd -n -c ${config}
"; ";
} }