Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ssh root@server 'bash -s' < myscript.sh
- OUT=`rpm -qa | grep ntpdate`
- if [ "$OUT" != "" ] ; then
- echo "ntpdate already installed"
- else
- yum install $1
- fi
- read -p "Package is not installed. Do you want to install it (y/n)?" choise
- $ ssh -t yourserver "$(<your_script)"
- $ ssh -t yourserver "$(<your_script)" arg1 arg2 ...
- scp myscript.sh root@server:/tmp && ssh root@server /tmp/myscript.sh
- OUT=$(ssh root@server rpm -qa | grep "$1");
- if [ "$OUT" != "" ] ; then
- echo "$1 already installed"
- else
- read -p "Package $1 is not installed. Do you want to install it (y/n)?" choice
- if [ "$choice" -eq "y" ]; then
- ssh root@server yum install "$1"
- fi
- fi
- hostname
- echo -n "Make your choice :"
- read choice
- echo "You typed " ${choice}
- echo done
- cat f | ssh [email protected] 'cat >remf'
- ssh user@remotehost bash remf
- christian@clafujiu:~/tmp$ ssh localhost bash tmp/f
- christian@localhost's password:
- Linux clafujiu 2.6.32-52-generic #114-Ubuntu SMP Wed Sep 11 19:00:15 UTC 2013 i686 GNU/Linux
- Sun Nov 10 14:58:56 GMT 2013
- Make your choice :abc
- You typed abc
- done
- REMID=`cat f |ssh user@remotehost 'cat > remf_$$; echo $$'` ;ssh [email protected] "bash remf_${REMID} ; rm -v remf_${REMID}"
Add Comment
Please, Sign In to add comment