Created
August 10, 2015 19:02
-
-
Save egobrain/5cbe2d7e5c26f87e1a66 to your computer and use it in GitHub Desktop.
erlang remsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
node=$1 | |
data=($(echo $node | tr "@" "$IFS")) | |
username=yk | |
name=${data[0]} | |
domain=${data[1]} | |
rand=$(date +%s | sha256sum | base64 | head -c 10 ; echo) | |
localname="${username}-${rand}" | |
echo "Connecting to \"${node}\" as \"${localname}\"" | |
echo -n "Determing cookie: " | |
cookie=$(ssh ${username}@${domain} "ps aux | grep \"\-name ${name}\" | grep setcookie" | sed -n 's/.*setcookie \([^ ]\+\).*/\1/p') | |
echo "$cookie" | |
erl -remsh ${node} -name ${localname} -setcookie ${cookie} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment