Всем Доброго здравия! Попробовал на днях x2go. Шикарная штука, быстро работает. Думаю перейти на него. Сейчас сижу на RX от etersoft. Так вот x2go быстрее работает. Но вот проблема, администрирования практически нет. Вот накидал вариант администрирования, по типу того как это было на nxserver.
#!/bin/bash
echo ""
echo "X2GOSERVER - Version:" `x2goversion x2goserver`
echo "============================="
if [ "$1" == "--help" ]; then
echo "age: x2goserver <option>
--start: Start the x2go server
--stop: Stop the x2go server
--status: Show status of nx server
--restart: Restart the nx server. (start,stop)
--list [ user | sessionid ]: List running sessions of user or sessionid
--terminate <user | :display | sessionid>: Terminate the session pointed to by
sessionid or display, or all sessions of the specified user.
Use * for all sessions.
--cleanup: Terminates all running sessions. Useful after power-outage."
fi
if [ "$1" == "--start" ]; then
cp /etc/ssh/x2go_on_sshd_config /etc/ssh/sshd_config
#/etc/init.d/ssh restart
service sshd restart
`echo "x2goserver runing" > /etc/ssh/x2gostatus`
echo "x2goserver runing"
fi
if [ "$1" == "--stop" ]; then
cp /etc/ssh/x2go_off_sshd_config /etc/ssh/sshd_config
#/etc/init.d/ssh restart
service sshd restart
`echo "x2goserver stoped" > /etc/ssh/x2gostatus`
echo "x2goserver stoped"
fi
if [ "$1" == "--restart" ]; then
/etc/init.d/x2goserver restart
fi
if [ "$1" == "--status" ]; then
cat /etc/ssh/x2gostatus
fi
if [ "$1" == "--list" ]; then
echo "Sessions list:"
echo "Display Username Remote IP Connection Time Session ID"
echo "................................................................................"
x2golistsessions_root | awk -F "|" '{print $3" "$12" "$8" "$6" "$2}'
fi
if [[ "$1" == "--terminate" && -n $2 ]]; then
mapfile -t sessions <<< `x2golistsessions_root | grep $2 | awk -F "|" '{print $2}'`
if [ "${sessions}" != "" ]; then
for line in "${sessions[@]}"; do
x2goterminate-session $line
echo Terminated $line
done
fi
fi
if [ "$1" == "--cleanup" ]; then
mapfile -t sessions <<< `x2golistsessions_root | awk -F "|" '{print $2}'`
if [ "${sessions}" != "" ]; then
for line in "${sessions[@]}"; do
x2goterminate-session $line
echo Terminated $line
done
fi
fi
if [[ "$1" == "--send" && -n $2 && -n $3 ]]; then
username=`x2golistsessions_root | grep $2 | awk -F "|" '{print $12}'`
mapfile -t sessions <<< `x2golistsessions_root | grep $2 | awk -F "|" '{print $3}'`
if [[ "${username}" != "" && "${sessions}" != "" ]]; then
for line in "${sessions[@]}"; do
#x2goterminate-session $line
# /usr/bin/sudo -u ${username} /usr/bin/zenity --display=:${line} --info --text="$3"
DISPLAY=:${line} sudo -u ${username} /usr/bin/zenity --warning --title="X2goServer Admin message" --text="$3"
echo $?
done
fi
fi
if [[ "$1" == "--broadcast" && -n $2 ]]; then
mapfile -t sessions <<< `/usr/sbin/x2golistsessions_root`
if [[ "${sessions}" != "" ]]; then
for line in "${sessions[@]}"; do
#echo $line
username=`echo ${line} | awk -F "|" '{print $12}'`
#echo $username
ses=`echo ${line} | awk -F "|" '{print $3}'`
#echo $ses
#sudo -u ${username} /usr/bin/zenity --display=:${ses} --info --text="$2"&
DISPLAY=:${ses} sudo -u ${username} /usr/bin/zenity --warning --title="X2goServer Admin message" --text="$2" && echo $? &
#echo Terminated $line
done
fi
fi
Смотрите пробуйте, замечания, поправки принимаются.