Jump to content

Obsolete:Batch initialisation script

From Wikitech
Note: This page was created as a temporary pastebin and probably doesn't make any sense without its proper context

Something similar to this was used for the August server batch.


#!/bin/bash

# Set up public keys
for x in `</usr/local/dsh/node_groups/new2`;do ssh $x mkdir -m 700 /root/.ssh;done
for x in `</usr/local/dsh/node_groups/new2`;do scp /root/.ssh/* $x:/root/.ssh/ ;done

# Copy user-related files
dsh -N new2 "mkdir -m700 /etc/new;mkdir -m700 /etc/old"
cd /etc
for x in `</usr/local/dsh/node_groups/new2`;do scp passwd passwd- shadow shadow- group group- gshadow $x:/etc/new/; done
dsh -N new2 "cd /etc;cp passwd passwd- shadow shadow- group group- gshadow old"
dsh -N new2 "cd /etc;cp -f new/* ."

# Set up NTP
dsh -N new2 "cd /;tar -xzf /home/config/others/clock.tgz"
dsh -N new2 "ln -s ../init.d/ntpd /etc/rc.d/rc5.d/S58ntpd 2>&1"
dsh -N new2 "ln -s ../init.d/ntpd /etc/rc.d/rc3.d/S58ntpd 2>&1"
dsh -N new2 /etc/init.d/ntpd start

See also