Thursday, July 30, 2020

whole lotta pies / Download config on reboot

So, I like to have all my pies download a set of configs at boot. Allows me to make a change
a centeralized location and push it out to everyone (When they reboot)

All pies get this in their /etc/rc.d/rc.local

/home/zero/updates/update.sh
#
/etc/sethostalias.sh > /etc/hostalias
#
/usr/sbin/netdate ntp1 >> /home/netdate/n3.netdate.log
#
sleep 20;
/etc/rc.d/rc.ntpd restart
#

and then of course /etc/fstab has a samba mounted share with the following

//cp1/zero      /home/zero      cifs      user=timc,pass=[password]       0   0

and the /home/zero/updates/update.sh has the following

#
#  Setup some variables
#
CP="/usr/bin/cp"
DIR="/home/zero/updates"
MKDIR="/usr/bin/mkdir"
#
#  Updatre aliases and hosts and profiles from CP1
#
$CP $DIR/sethostalias.sh /etc
$CP $DIR/hosts /etc
$CP $DIR/profile /etc
$CP $DIR/alias /etc
#
#  Make a bin directory for root on host
#
EDIR="/root/bin"
if [ ! -d $EDIR ]; then
  $MKDIR $EDIR
  $CP $DIR/bin/ $EDIR
fi
#
#  Couple files for Serial stuff on PI's
#
$CP $DIR/config.txt /root
$CP $DIR/cmdline.txt /root
$CP $DIR/inittab /root
#
# Couple fixes for snmp / ntp
$CP $DIR/rc.M /etc/rc.d/
$CP $DIR/snmpd.conf /etc/snmp/
$CP $DIR/ntp.conf /etc/

with all the appropiate file goodies. This seems to fluctuate based upon what I’m doing…

Add comment

Fill out the form below to add your own comments