r - how to send different commands to multiple hosts to run programs in Linux -
i r user. run programs on multiple computers of campus. example, need run 10 different programs. need open putty 10 times log 10 different computers. , submit each of programs each of 10 computers (their os linux). there way log in 10 different computers , send them command @ same time? use following command submit program
nohup rscript l_1_cc.r > l_1_sh.txt nohup rscript l_2_cc.r > l_2_sh.txt nohup rscript l_3_cc.r > l_3_sh.txt
first set ssh can login without entering password (google if don't know how). write script ssh each remote host run command. below example.
#!/bin/bash host_list="host1 host2 host3 host4 host5 host6 host7 host8 host9 host10" h in $host_list case $h in host1) ssh $h nohup rscript l_1_cc.r > l_1_sh.txt ;; host2) ssh $h nohup rscript l_2_cc.r > l_2_sh.txt ;; esac done
this simplistic example. can better (for example, can put ".r" , ".txt" file names variable , use rather explicitly listing every option in case).
Comments
Post a Comment