Skip to content

Instantly share code, notes, and snippets.

@egobrain
Created August 10, 2015 19:02
Show Gist options
  • Save egobrain/5cbe2d7e5c26f87e1a66 to your computer and use it in GitHub Desktop.
Save egobrain/5cbe2d7e5c26f87e1a66 to your computer and use it in GitHub Desktop.
erlang remsh
#!/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