|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Operating Systems > Linux, Unix | |
Run script on different computers
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | ||||||||||||||
|
4.0 GHz
![]() |
Here's the setup:
I'm working with several different servers: a file server, web server, admin server (LDAP), a backup server, ect. These are somewhat ad-hoc and not part of an "over-arching" network (apart from the department, but these only belong to a small-subset of that). There's also an off-site cluster that is used. Here's the problem: When some new user needs to be added, I need to manually add them to each server. I need to give them directories on the file server, set up their web folders on the web server, set up their access on the LDAP server, ect. I've automated this to running a single script on each server, but still have to jump to each individually and run the respective add user code. This can get tedious when there's a big group of new users to add. Here's the question: I'm curious as how to automate this into a single script that will run all these server-specific scripts automatically. My ideas so far: The solution I'm cobbling together inside my head is to set up a small daemon on each server and broadcast an "add user someuser" command from a central location, and have each server daemon act accordingly. Is there a more straight-forward way to do this?
__________________
3DMark06: 19091 - 3DMark Vantage: P15264 - SuperPi: 10.968s Programming Quote of the Day: Bjarne Stroustrup: Quote:
|
||||||||||||||
|
|
|
|
|
#2 (permalink) | ||||||||||||||
|
Linux Lobbyist
![]() |
Doesn't seem like it would be that hard, but I would have to look into it. Sorry.
__________________
Quote:
|
||||||||||||||
|
|
|
|
|
#3 (permalink) | |||||||||
|
Linux Lobbyist
|
SSH to the machines, no point running around to them.
__________________
Yeah, I got this PC for free, can you tell?.
I'll be building my own PC this summer
|
|||||||||
|
|
|
|
|
#4 (permalink) | ||||||||||||
|
4.0 GHz
|
if your machines are setup correctly with passkeys then this is an over simplified way of doing what you need
script on you machine Code:
file name addnewusers #!/bin/bash scp userstoadd.txt useraccount@ipaddressoffileserver:userstoadd.txt ssh useraccount@ipaddressoffileserver ./addusr scp userstoadd.txt useraccount@ipaddressofwebserver:userstoadd.txt ssh useraccount@ipaddressofwebserver ./addusr scp userstoadd.txt useraccount@ipaddressofadminserver:userstoadd.txt ssh useraccount@ ipaddressofadminserver./addusr scp userstoadd.txt useraccount@ipaddressofbackupserver:userstoadd.txt ssh useraccount@ ipaddressofbackupserver./addusr scp userstoadd.txt useraccount@ipaddressofclusterserver:userstoadd.txt ssh useraccount@ ipaddressofclusterserver./addusr Code:
file name userstoadd.txt last line in file is "end" tom bill frank sandy sherry lynn jeff end Code:
file name assusr #/bin/bash count=1 usersname=$(tail +$count userstoadd.txt | head -n1) while [ "$usersname" != "end" ] do #./xz echo "$count user named $usersname added" # ./ADDUSERSCRIPT $a count=`expr $count + 1` usersname=$(tail +$count userstoadd.txt | head -n1) done exit Code:
file name ADDUSERSCRIPT #/bin/bash useradd $1 passwd $1
|
||||||||||||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|