[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

help my friends, windows can normally do this but it won't

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 14
Thread images: 1

File: 1464266757659.jpg (40KB, 657x527px) Image search: [Google]
1464266757659.jpg
40KB, 657x527px
help my friends, windows can normally do this but it won't cut it in this instance, I need a way to run one command with just one parameter being sequencial throughout a few tens of servers for my mate.
I have ssh access to all of them and have the program running on each.

I can make them read the IPs from a file and run one command which is the same using
 for host in $(cat hosts.txt); do ssh "$host" "$command" >"output.$host"; done 
but what I need is it to do the certain command with
-u d[1-160]
on each server going up by one each time. Can anyone think of an easy solution?
>>
For i, host in ... -u $i
>>
>>61822769
Increment a variable in the for loop?
Or what are you asking?
>>
>>61822769
Fuck server scripting in Linux, man. Either install Windows Server or just fucking suck up to the fact that you will never be productive in a Linux environment. I bet you can't even write a script to automate all of this in Bash, whereas Powershell can do all of this in a breeze and is 10x more powerful of a language. OP, some advice for you, just do this shit in a respectable language like C# or Ruby. I dare someone to prove me wrong and show me that Bash is actually not a gimped language.

t. system administrator for an australian private school
>>
>>61822827
1. Ruby doesn't ship with an SSH gem by default
2. OP needs to call a shell command ($command), which means he'll have to call system anyway, thereby making Ruby a pointless layer of abstraction
3. You're a sunbaked drongo
>>
>>61822812
The host part is seperate and Just Werks™.

>>61822820
or create a seperate loop for command to increment it every time i hop to the next server.

>>61822827
sym
>>
>>61822886
Show that you can do what OP wanted in bash without jumping through major hoops and hurdles
>>
>>61822886
that's because bash is a daft language for NEETs
>>
for host in $(cat hosts.txt); do ssh "$host" "$command -u d["{1..160}"]"; done
>>
>>61822959
What about authentication
>>
>>61822959
yeah what >>61822975 said
>>
>>61822975
ssh keys or sshpass

https://serverfault.com/questions/241588/how-to-automate-ssh-login-with-password
>>
>>61822959
>>61823000
Thanks faggot. Always a great helper you guys are.
>>
You can do:
ssh -tt "${REMOTEUSER}"@"${REMOTEIP}" "stty raw -echo; ${COMMANDS}"

And build up commands as successive command strings ending in ;, like:

COMMANDS=""
COMMANDS+="echo REEEEEEEEEEEEEE ;"
COMMANDS+="echo EAT SHIT REEEEEEEE;"


If it takes multiple lines to get single/double quotes right, then do it.
Thread posts: 14
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.