Guest User

Untitled

a guest
Jan 3rd, 2018
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. ssh root@server 'bash -s' < myscript.sh
  2.  
  3. OUT=`rpm -qa | grep ntpdate`
  4. if [ "$OUT" != "" ] ; then
  5. echo "ntpdate already installed"
  6. else
  7. yum install $1
  8. fi
  9.  
  10. read -p "Package is not installed. Do you want to install it (y/n)?" choise
  11.  
  12. $ ssh -t yourserver "$(<your_script)"
  13.  
  14. $ ssh -t yourserver "$(<your_script)" arg1 arg2 ...
  15.  
  16. scp myscript.sh root@server:/tmp && ssh root@server /tmp/myscript.sh
  17.  
  18. OUT=$(ssh root@server rpm -qa | grep "$1");
  19. if [ "$OUT" != "" ] ; then
  20. echo "$1 already installed"
  21. else
  22. read -p "Package $1 is not installed. Do you want to install it (y/n)?" choice
  23. if [ "$choice" -eq "y" ]; then
  24. ssh root@server yum install "$1"
  25. fi
  26. fi
  27.  
  28. hostname
  29. echo -n "Make your choice :"
  30. read choice
  31. echo "You typed " ${choice}
  32. echo done
  33.  
  34. cat f | ssh [email protected] 'cat >remf'
  35. ssh user@remotehost bash remf
  36.  
  37. christian@clafujiu:~/tmp$ ssh localhost bash tmp/f
  38. christian@localhost's password:
  39. Linux clafujiu 2.6.32-52-generic #114-Ubuntu SMP Wed Sep 11 19:00:15 UTC 2013 i686 GNU/Linux
  40. Sun Nov 10 14:58:56 GMT 2013
  41. Make your choice :abc
  42. You typed abc
  43. done
  44.  
  45. 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