applied some corrections
This commit is contained in:
parent
abf7786020
commit
66d877d267
2 changed files with 16 additions and 16 deletions
26
ssh-local.sh
26
ssh-local.sh
|
@ -12,11 +12,11 @@
|
||||||
# and % will delete the parameter at the end.
|
# and % will delete the parameter at the end.
|
||||||
|
|
||||||
|
|
||||||
USER="root"
|
User="root"
|
||||||
PORT=10022
|
Port=10022
|
||||||
VERSION="1.0"
|
Version="1.0.1"
|
||||||
|
|
||||||
HELP_MESSAGE="
|
Help_message="
|
||||||
ssh-local [OPTION] [OPTION=VALUE]
|
ssh-local [OPTION] [OPTION=VALUE]
|
||||||
|
|
||||||
script which permit to launch ssh to connect to the vm on localhost without letting any traces on this computer.
|
script which permit to launch ssh to connect to the vm on localhost without letting any traces on this computer.
|
||||||
|
@ -34,10 +34,10 @@ for (( arg=1; arg<$#; arg++)); do
|
||||||
value="$((arg+1))"
|
value="$((arg+1))"
|
||||||
if [ "${!arg}" == "-u" ]
|
if [ "${!arg}" == "-u" ]
|
||||||
then
|
then
|
||||||
USER=${!value}
|
User=${!value}
|
||||||
elif [ "${!arg}" == "-p" ]
|
elif [ "${!arg}" == "-p" ]
|
||||||
then
|
then
|
||||||
PORT=${!value}
|
Port=${!value}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -47,23 +47,23 @@ done
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
if [ "${i%=*}" == "--user" ]
|
if [ "${i%=*}" == "--user" ]
|
||||||
then
|
then
|
||||||
USER="${i#*=}"
|
User="${i#*=}"
|
||||||
elif [ "${i%=*}" == "--port" ]
|
elif [ "${i%=*}" == "--port" ]
|
||||||
then
|
then
|
||||||
PORT="${i#*=}"
|
Port="${i#*=}"
|
||||||
elif [ "${i}" == "--version" ] || [ "${i}" == "-v" ]
|
elif [ "${i}" == "--version" ] || [ "${i}" == "-v" ]
|
||||||
then
|
then
|
||||||
echo "Prog ssh-local v.${VERSION}"
|
echo "Prog ssh-local v.${Version}"
|
||||||
exit 0
|
exit 0
|
||||||
elif [ "${i}" == "--help" ] || [ "${i}" == "-h" ]
|
elif [ "${i}" == "--help" ] || [ "${i}" == "-h" ]
|
||||||
then
|
then
|
||||||
echo "$HELP_MESSAGE"
|
echo "$Help_message"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo user=${USER}
|
echo try to connect with user=${User} and port=${Port}
|
||||||
echo port=${PORT}
|
echo port=${Port}
|
||||||
|
|
||||||
ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null" -p ${PORT} ${USER}@localhost
|
ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null" -p ${Port} ${User}@localhost
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#RESULT_POSSIBLE=("init","start","start_backup","create","backup","restore","suppr")
|
#RESULT_POSSIBLE=("init","start","start_backup","create","backup","restore","suppr")
|
||||||
|
|
||||||
# Constante d'éxecutions.
|
# Constante d'éxecutions.
|
||||||
Version="0.6"
|
Version="0.6.1"
|
||||||
USAGE="vm-start [ NAME COMMAND [PARAMETER] ] [OPTION]
|
USAGE="vm-start [ NAME COMMAND [PARAMETER] ] [OPTION]
|
||||||
|
|
||||||
Script to manage virtual machine easily.
|
Script to manage virtual machine easily.
|
||||||
|
@ -151,7 +151,7 @@ RESTORE() {
|
||||||
read -r entry
|
read -r entry
|
||||||
if [[ $entry =~ ^[yY]$ ]]
|
if [[ $entry =~ ^[yY]$ ]]
|
||||||
then
|
then
|
||||||
cp ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow.backup ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow
|
cp -i ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow.backup ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow
|
||||||
echo "Done"
|
echo "Done"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ BACKUP() {
|
||||||
read -p "Are you sure you want to backup the volume? If you continue the previous backup will be lost (y/N) " -r entry
|
read -p "Are you sure you want to backup the volume? If you continue the previous backup will be lost (y/N) " -r entry
|
||||||
if [[ $entry =~ ^[yY]$ ]]
|
if [[ $entry =~ ^[yY]$ ]]
|
||||||
then
|
then
|
||||||
cp ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow.backup
|
cp -i ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow.backup
|
||||||
echo "Done"
|
echo "Done"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue