#!/bin/bash
#used for cli command "set system services ssh protocol-version"
#input $1: version of ssh .
#$1 can be "v1" or "v2"
#no output


if [[ $1 = "v1" ]]; then
    sed -i "s/^Protocol.*/Protocol 2/g" /etc/ssh/sshd_config 
elif [[ $1 = "v2" ]]; then
    sed -i "s/^Protocol.*/Protocol 2/g" /etc/ssh/sshd_config
fi

#kill -HUP `ps | grep -v grep | grep '/usr/sbin/sshd' | awk '{print $1}'`
if [ -f /var/run/sshd.pid ];then
    /etc/init.d/ssh reload > /dev/null
fi
#/usr/sbin/sshd
exit 0
