siotp/sisr1/tp04_scripts_admin/deployUsers.sh

17 lines
384 B
Bash

#!/bin/bash
# Première version
ip=$1
user=root
workdir=/$user/deploy
ssh $user@$ip "mkdir $workdir" 2> /dev/null
# Copie des scripts et fichiers
scp "./createGroups.sh" "./logins.csv" "./Users.csv" "./createUsers.sh" $user@$ip:$workdir
# Exécution les scripts
ssh $user@$ip << EOF
cd $workdir
bash createGroups.sh
bash createUsers.sh
EOF
ssh $user@$ip "rm -R $workdir"