I have a script written successfully and tuned by our members, now I am trying to execute this script from a taxi server.
My aim is I want to connect to four servers via ssh where I want to ran a script or run some commands and write the output to a file in the Taxi server.
I tried to write some script using some sample script but failed to succeed. Please help me.
I tired this with a script available in the froum and its work fine for me now. I have created a public key so that the server ssh without any password prompt.
But now there is only one issue which I think I need some help.
This is the script which I have written in the taxi server where form I am connecting
bash-2.05$ cat connect.sh
#!/usr/bin/sh
while read box
do
ssh -n $box -l mvelmu 'hostname ; ksh /axphome/mvelmu/count.ksh' >> machineaddress.txt
done < "output.txt"
but when I ran this above script its returning with the results in the output.txt, but in the console I am able to see some system generated messages, how to suppress that messages.
THIS SYSTEM IS RESTRICTED TO AUTHORIZED USERS AND BUSINESS PURPOSES
ONLY. INDIVIDUALS ATTEMPTING UNAUTHORIZED ACCESS AND NON-BUSINESS
UTILIZATION ARE LIABLE FOR DAMAGES INCLUDING THE VALUE OF DIVERTED
RESOURCES AND CRIMINAL PROSECUTION.
By continuing to login you agree to the above and accept responsibility
for all of your actions.
Repeating four times as I am connecting to four servers.
I have tried this but i am getting following error.
for all of your actions.
THIS SYSTEM IS RESTRICTED TO AUTHORIZED USERS AND BUSINESS PURPOSES
ONLY. INDIVIDUALS ATTEMPTING UNAUTHORIZED ACCESS AND NON-BUSINESS
UTILIZATION ARE LIABLE FOR DAMAGES INCLUDING THE VALUE OF DIVERTED
RESOURCES AND CRIMINAL PROSECUTION.
By continuing to login you agree to the above and accept responsibility
for all of your actions.
Usage: grep [OPTION]... PATTERN [FILE]...
Usage: grep [OPTION]... PATTERN [FILE]...
Usage: grep [OPTION]... PATTERN [FILE]...
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
bash-2.05$ ./connect_new.sh
./connect_new.sh: * ; ksh /axphome/mvelmu/count.ksh: not found
./connect_new.sh: * ; ksh /axphome/mvelmu/count.ksh: not found
./connect_new.sh: * ; ksh /axphome/mvelmu/count.ksh: not found
./connect_new.sh: * ; ksh /axphome/mvelmu/count.ksh: not found
bash-2.05$ THIS SYSTEM IS RESTRICTED TO AUTHORIZED USERS AND BUSINESS PURPOSES
ONLY. INDIVIDUALS ATTEMPTING UNAUTHORIZED ACCESS AND NON-BUSINESS
UTILIZATION ARE LIABLE FOR DAMAGES INCLUDING THE VALUE OF DIVERTED
RESOURCES AND CRIMINAL PROSECUTION.
By continuing to login you agree to the above and accept responsibility
for all of your actions.
THIS SYSTEM IS RESTRICTED TO AUTHORIZED USERS AND BUSINESS PURPOSES
ONLY. INDIVIDUALS ATTEMPTING UNAUTHORIZED ACCESS AND NON-BUSINESS
UTILIZATION ARE LIABLE FOR DAMAGES INCLUDING THE VALUE OF DIVERTED
RESOURCES AND CRIMINAL PROSECUTION.
By continuing to login you agree to the above and accept responsibility
for all of your actions.
THIS SYSTEM IS RESTRICTED TO AUTHORIZED USERS AND BUSINESS PURPOSES
ONLY. INDIVIDUALS ATTEMPTING UNAUTHORIZED ACCESS AND NON-BUSINESS
UTILIZATION ARE LIABLE FOR DAMAGES INCLUDING THE VALUE OF DIVERTED
RESOURCES AND CRIMINAL PROSECUTION.
By continuing to login you agree to the above and accept responsibility
for all of your actions.
THIS SYSTEM IS RESTRICTED TO AUTHORIZED USERS AND BUSINESS PURPOSES
ONLY. INDIVIDUALS ATTEMPTING UNAUTHORIZED ACCESS AND NON-BUSINESS
UTILIZATION ARE LIABLE FOR DAMAGES INCLUDING THE VALUE OF DIVERTED
RESOURCES AND CRIMINAL PROSECUTION.
By continuing to login you agree to the above and accept responsibility
for all of your actions.
Usage: grep [OPTION]... PATTERN [FILE]...
Usage: grep [OPTION]... PATTERN [FILE]...
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
Try `grep --help' for more information.
Try `grep --help' for more information.
bash-2.05$ cat connect_new.sh
#!/usr/bin/sh
while read box
do
ssh -n $box -l mvelmu 'hostname 2>&1 ; ksh /axphome/mvelmu/count.ksh' >> /home/mvelmu/$boxoutput.txt
done < "/home/mvelmu/machineaddress.txt"
bash-2.05$ ./connect_new.sh
THIS SYSTEM IS RESTRICTED TO AUTHORIZED USERS AND BUSINESS PURPOSES
ONLY. INDIVIDUALS ATTEMPTING UNAUTHORIZED ACCESS AND NON-BUSINESS
UTILIZATION ARE LIABLE FOR DAMAGES INCLUDING THE VALUE OF DIVERTED
RESOURCES AND CRIMINAL PROSECUTION.
By continuing to login you agree to the above and accept responsibility
for all of your actions.