Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- printf "输入 DotCloud 认用名字: " >&2
- read
- AppID="${REPLY}.www"
- key="$HOME/.dotcloud/dotcloud.key"
- lport=7070
- rport=$(dotcloud info "$AppID" | sed '/ssh:\/\/.*/!d;s/^.*\/\///' | cut -d: -f2)
- host=$(dotcloud info "$AppID" | sed '/ssh:\/\/.*/!d;s/^.*\/\///' | cut -d: -f1)
- script_name="$HOME/${REPLY}_ssh"
- if [ ! -f "$key" ] ; then
- echo "You do not have $key, I can\'t make ssh script" >&2
- exit 5
- fi
- if [ -z "$host" ] ; then
- echo "Your DotCloud APPID seems not found. Fail to make ssh script." >&2
- exit 6
- fi
- echo "ssh -i $key -vNfD $lport $host -p $rport" > "$script_name"
- [ $? -eq 0 ] && chmod 755 "$script_name" && echo "$script_name is made."
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement