Commit 1d8bae47 authored by Ryan Jackson's avatar Ryan Jackson
Browse files

Fix syslog configuration for subbosses

Make sure that dhcpd, tftpd, and frisbeed all log to /usr/testbed/log
instead of /var/log, and set up log rotation for them.
parent 7820bdc5
......@@ -32,25 +32,49 @@ my $TBDIR = "/usr/testbed";
my ($bossname, $outer_bossip) = tmccbossinfo();
sub fix_syslog_conf()
{
my @buffer;
open SYSLOG_CONF, "+</etc/syslog.conf" or
Fatal("Couldn't open syslog.conf for writing");
while (<SYSLOG_CONF>) {
next if (/dhcp/i || /tftp/i);
push @buffer, $_;
}
seek SYSLOG_CONF, 0, 0;
print SYSLOG_CONF $_ for @buffer;
print SYSLOG_CONF "!dhcpd\n";
print SYSLOG_CONF "*.*\t\t\t\t\t\t/usr/testbed/log/dhcpd.log\n";
print SYSLOG_CONF "!tftpd\n";
print SYSLOG_CONF "*.*\t\t\t\t\t\t/usr/testbed/log/tftpd.log\n";
close SYSLOG_CONF;
}
sub doboot()
{
my $EXTRAFS = "/z";
my $TFTPBOOT_DIR = "$EXTRAFS/tftpboot";
my $LOG_DIR = "$EXTRAFS/log";
my $IMAGES_DIR = "$EXTRAFS/image_cache";
my $stuffdir = "$EXTRAFS/tmp";
my $MFSTARBALL = "tftpboot-subboss.tar.gz";
goto skipsetup if (!SUBBOSS());
print "Stopping tftpd (if running)";
print "Stopping tftpd (if running)\n ";
# This needs to be system(), not mysystem since we don't
# care if it fails.
system("/usr/local/etc/rc.d/tftpd-hpa.sh stop");
RecreateDir($EXTRAFS,1);
mysystem("$BINDIR/mkextrafs.pl -f $EXTRAFS");
mysystem("mkdir -p $TFTPBOOT_DIR $IMAGES_DIR $stuffdir");
mysystem("mkdir -p $TFTPBOOT_DIR $IMAGES_DIR $LOG_DIR $stuffdir");
mysystem("ln -sf $TFTPBOOT_DIR /tftpboot");
mysystem("ln -sf $IMAGES_DIR $TB/image_cache");
mysystem("ln -sf $IMAGES_DIR $TBDIR/image_cache");
mysystem("ln -sf $LOG_DIR $TBDIR/log");
print "Copying over tftpboot tar file from web server and unpacking\n";
......@@ -63,8 +87,11 @@ sub doboot()
mysystem("tar xzf $stuffdir/tftpboot.tar.gz -C /tftpboot");
# FIXME clean up stuffdir?
print "Restarting tftpd";
print "Restarting tftpd\n ";
mysystem("/usr/local/etc/rc.d/tftpd-hpa.sh start");
print "Configuring syslogd\n ";
fix_syslog_conf();
skipsetup:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment