Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Operating Systems > Linux, Unix

Reply
 
LinkBack Thread Tools
Old 3 Weeks Ago   #1 (permalink)
4.0 GHz
 
dharmaBum's Avatar
 
intel nvidia

Join Date: Apr 2007
Location: Raleigh, NC
Posts: 747

Rep: 121 dharmaBum is acknowledged by manydharmaBum is acknowledged by many
Unique Rep: 89
Trader Rating: 0
Default Run script on different computers

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:
There are only two industries that refer to their customers as ‘users’.

System: Europa
CPU
E8500 4.36ghz @ 1.36v
Motherboard
EVGA 780i SLi P05 Bios
Memory
G.SKILL 4GB(2x2GB) @ 924MHz (5-4-4-12-2T)
Graphics Card
2xEVGA 8800GTS (G92) 512MB @800/2000/2110
Hard Drive
Seagate 500gbx2, (fake-)RAID0
Sound Card
Sound Blaster X-Fi XtremeGamer
Power Supply
CORSAIR 1000HX 1000W
Case
Gigabyte GZ-FA2CA-AJB Black Aluminum
CPU cooling
TDX 775 Block, 360 BlackIce rad
GPU cooling
MAZE5x2, TT copper HS
OS
Fedora10-86_64/Vista64
Monitor
22" Samsung SyncMaster 2232BW
dharmaBum is offline   Reply With Quote
Old 3 Weeks Ago   #2 (permalink)
Linux Lobbyist
 
GodofGrunts's Avatar
 
intel nvidia

Join Date: Nov 2007
Location: Hamilton, Ohio
Posts: 2,437

Rep: 140 GodofGrunts is acknowledged by manyGodofGrunts is acknowledged by many
Unique Rep: 116
Trader Rating: 2
Default

Doesn't seem like it would be that hard, but I would have to look into it. Sorry.
__________________
Quote:
Originally Posted by MrDeodorant View Post
Oh, and the mayonnaise fanboys come out. Go back to your cave, troll. 2mm of mayonnaise is all anyone really needs. You don't have the ketchup bandwidth to support any more.

L2Sammich, noob. Besides, I'm running a Miracle Whip distro.
Click below to show/hide Hidden Text Below!
Quote:
Originally Posted by Raptor_Jesus View Post
Exactly what GodofGrunts said.
Quote:
Originally Posted by GodofGrunts View Post
Exactly what Raptor_Jesus said.
Quote:
Originally Posted by kerbitroy View Post
Exactly what they said :P
Quote:
Originally Posted by GodofGrunts View Post
Exactly what she said.
Quote:
Originally Posted by esocid View Post
Universe asplodes.





System: The Monolith
CPU
Q6600 G0 3.21 GHz
Motherboard
Asus P5K
Memory
4 GB 2x2GB OCZ
Graphics Card
8800GT Alpha Dog Edition 512MB
Hard Drive
WD 500GB Sata
Sound Card
Onboard
Power Supply
600W Ultra
Case
Monolith
CPU cooling
Scythe Ninja 2
GPU cooling
Aftermarket
OS
Mythbuntu 9.04 x64
Monitor
17" Dell LCD
GodofGrunts is offline GodofGrunts's Gallery   Reply With Quote
Old 3 Weeks Ago   #3 (permalink)
Linux Lobbyist
 
Jimi's Avatar
 
intel ati

Join Date: Sep 2009
Location: Philadelphia suburbs
Posts: 168

Rep: 6 Jimi Unknown
Unique Rep: 6
Trader Rating: 0
Default

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

System: [Freebie] - Dell XPS Gen 2
CPU
Intel Pentium 4 Processor 3.20 GHz w/ HT
Motherboard
Dell H0153 Intel 875P Chipset
Memory
2G DDR
Graphics Card
RADEON 9800 XT
Hard Drive
250G WD & 250G Maxtor
Sound Card
Creative SoundBlaster Audigy 2 ZS 7.1 HD
OS
Arch Linux i686
Monitor
1440x900 Acer X193Wbd 19"
Jimi is offline   Reply With Quote
Old 3 Weeks Ago   #4 (permalink)
4.0 GHz
 
tom.slick's Avatar
 
intel nvidia

Join Date: May 2009
Location: S. Orange County
Posts: 173

Rep: 19 tom.slick Unknown
Unique Rep: 18
Trader Rating: 0
Default

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
text file with user names on you machine
Code:
file name userstoadd.txt
last line in file is "end"

tom
bill
frank
sandy
sherry
lynn
jeff
end
script on remote machine
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
your script using command line argument as user name
Code:
file name ADDUSERSCRIPT

#/bin/bash
useradd $1
passwd $1
just an example

System: Core I7
CPU
I7 920 rev. D0
Motherboard
Asus P6T Deluxe v2
Memory
OCZ XMP 3x2Gb (pc3 12800)
Graphics Card
EVGA GTX 285
Hard Drive
Western Digital Caviar Black 640Gb x 2
Power Supply
CORSAIR 850TX
Case
Cooler Master ATCS 840
CPU cooling
Watercool HEATKILLER Rev3.0 LT/XSPC RX360
GPU cooling
Bitspower VG-NGTX285B/XSPC RX240
OS
openSuse 11.1 x64/Win 7U x64
Monitor
HP F2105
tom.slick is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -5. The time now is 06:27 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License

Terms of Service / Forum Rules | Privacy Policy | DMCA Info | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.10715 seconds with 8 queries