Add a new DSSH/DSCP list of servers
Aus HS Syswiki
Version vom 17. Juni 2014, 15:35 Uhr von Vkl (Diskussion | Beiträge)
# example - create a new command dssh10/dscp10 # 1. create a list of servers bkp001.hr19: cd /etc cp dcmdall.hosts dcmd10.hosts bkp001.hr19: cd /usr/local/bin/ # list of related files bkp001.hr19:/usr/local/bin # ls -la | egrep "[dscp|dcmd]10" -rwxr-xr-x 1 root root 2571 Feb 7 15:11 dcmd10 -rwxr-xr-x 1 root root 1123 Feb 7 15:11 dcmd10_distributeKeys -rwxr-xr-x 1 root root 1348 Feb 7 15:11 dcmd10_getHostsFile -rwxr-xr-x 1 root root 1038 Feb 7 15:11 dcmd10_getMaxHostNameLength -rwxr-xr-x 1 root root 3038 Feb 7 15:11 dcmd10_synchronous -rwxr-xr-x 1 root root 822 Feb 7 15:11 dscp10 -rwxr-xr-x 1 root root 823 Feb 25 2008 dscp103 # 2. prepare commands cp dcmd10 dcmd5 cp dcmd10_distributeKeys dcmd5_distributeKeys cp dcmd10_getHostsFile dcmd5_getHostsFile cp dcmd10_getMaxHostNameLength dcmd5_getMaxHostNameLength cp dcmd10_synchronous dcmd5_synchronous cp dscp10 dscp5 cp dssh10 dssh5 # list of new files dcmd5 dcmd5_distributeKeys dcmd5_getHostsFile dcmd5_getMaxHostNameLength dcmd5_synchronous dscp5 dssh5 # 3. change the values in new files sed -i 's/dcmd10/dcmd5/g' dcmd5 sed -i 's/dcmd10/dcmd5/g' dcmd5_distributeKeys sed -i 's/dcmd10/dcmd5/g' dcmd5_getHostsFile sed -i 's/dcmd10/dcmd5/g' dcmd5_getMaxHostNameLength sed -i 's/dcmd10/dcmd5/g' dcmd5_synchronous sed -i 's/dcmd10/dcmd5/g' dscp5 sed -i 's/dcmd10/dcmd5/g' dssh5 ################################################################## # Example: ################################################################## cd /etc/ cp dcmdlast.hosts dcmdlastg1.hosts cd /usr/local/bin/ cp dcmdlast dcmdlastg1 cp dcmdlast_distributeKeys dcmdlastg1_distributeKeys cp dcmdlast_getHostsFile dcmdlastg1_getHostsFile cp dcmdlast_getMaxHostNameLength dcmdlastg1_getMaxHostNameLength cp dcmdlast_synchronous dcmdlastg1_synchronous cp dscplast dscplastg1 cp dsshlast dsshlastg1 sed -i 's/dcmdlast/dcmdlastg1/g' dcmdlastg1 sed -i 's/dcmdlast/dcmdlastg1/g' dcmdlastg1_distributeKeys sed -i 's/dcmdlast/dcmdlastg1/g' dcmdlastg1_getHostsFile sed -i 's/dcmdlast/dcmdlastg1/g' dcmdlastg1_getMaxHostNameLength sed -i 's/dcmdlast/dcmdlastg1/g' dcmdlastg1_synchronous sed -i 's/dcmdlast/dcmdlastg1/g' dscplastg1 sed -i 's/dcmdlast/dcmdlastg1/g' dsshlastg1 vim /etc/dcmdlastg1.hosts