Steps followed to SSH and execute a set of commands:
1. Login to the power cycler using ssh
2. Issue power cycle command
Below is a working sample:
root@FR-121:~# cat cycle_katana
sshpass -p "cisco123" ssh -o StrictHostKeyChecking=no admin@10.105.108.26 << EOF
power outlets 7 cycle /y
EOF
root@FR-121:~#
Source: http://www.shellhacks.com/en/Running-Commands-on-a-Remote-Linux-Server-over-SSH
################################################################################
Execute a single command over ssh:
[ats-earms-lnx:/auto/tftp-blr-users1/srikragh]>ssh root@10.104.99.121 "sudo lsof -t -i:1645"
10493
[ats-earms-lnx:/auto/tftp-blr-users1/srikragh]>
1. Login to the power cycler using ssh
2. Issue power cycle command
Below is a working sample:
root@FR-121:~# cat cycle_katana
sshpass -p "cisco123" ssh -o StrictHostKeyChecking=no admin@10.105.108.26 << EOF
power outlets 7 cycle /y
EOF
root@FR-121:~#
Source: http://www.shellhacks.com/en/Running-Commands-on-a-Remote-Linux-Server-over-SSH
################################################################################
Execute a single command over ssh:
[ats-earms-lnx:/auto/tftp-blr-users1/srikragh]>ssh root@10.104.99.121 "sudo lsof -t -i:1645"
10493
[ats-earms-lnx:/auto/tftp-blr-users1/srikragh]>
Source: http://www.cyberciti.biz/faq/unix-linux-execute-command-using-ssh/
No comments:
Post a Comment