UBUNTU 14.04 X64 - XFCE WITH VNC - AUTO LOGIN, AUTO START WINE APP
adduser rapid_vn
sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-get install xfce4
sudo apt-get install firefox
sudo apt-get install gnome-schedule
sudo apt-get install wine
sudo apt-get upgrade
sudo apt-get clean
УСТАНОВИТЬ НАПРЯМУЮ VNC-СЕРВЕР
apt-get install tightvncserver
ИЗМЕНИТЬ ПОЛЬЗОВАТЕЛЯ
su - rapid_vn
УСТАНОВИТЬ ПАРОЛЬ ДЛЯ СЕРВЕРА VNC С ПОЛЬЗОВАТЕЛЕМ Rapid_vn
vncpasswd
ВЫЙТИ ПОЛЬЗОВАТЕЛЬ Rapid_vn
exit
НАСТРОЙКА VNC-СЕРВЕРА
nano /etc/init.d/vncserver
#!/bin/bash
PATH="$PATH:/usr/bin/"
export USER="rapid_vn"
DISPLAY="1"
DEPTH="16"
DPI="96"
GEOMETRY="800x600"
OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} -alwaysshared -dpi ${DPI} :${DISPLAY}"
. /lib/lsb/init-functions
case "$1" in
start)
log_action_begin_msg "STARTING VNCSERVER FOR USER '${USER}' ON LOCALHOST:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;
stop)
log_action_begin_msg "STOPING VNCSERVER FOR USER '${USER}' ON LOCALHOST:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
;;
restart)
$0 stop
$0 start
;;
esac
exit 0
nano /home/rapid_vn/.vnc/xstartup
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
startxfce4 &
chown -R rapid_vn. /home/rapid_vn/.vnc && chmod +x /home/rapid_vn/.vnc/xstartup
sed -i 's/allowed_users.*/allowed_users=anybody/g' /etc/X11/Xwrapper.config
chmod +x /etc/init.d/vncserver
service vncserver start
update-rc.d vncserver defaults
reboot
АВТОЗАПУСК FIREFOX ПРИ ПЕРЕЗАГРУЗКЕ
mkdir /home/rapid_vn/.config
mkdir /home/rapid_vn/.config/autostart
chmod u=rwx,g=rwx,o=rwx /home/rapid_vn/.config
chmod u=rwx,g=rwx,o=rwx /home/rapid_vn/.config/autostart
nano /home/rapid_vn/.config/autostart/firefox.desktop
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Firefox Browser
Comment=Firefox Browser
Exec=/usr/bin/firefox
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=false
АВТОМАТИЧЕСКИЙ ЗАПУСК MT4 ПРИ ПЕРЕЗАГРУЗКЕ
nano /home/rapid_vn/.config/autostart/metatrader4.desktop
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=MetaTrader 4
Comment=MetaTrader 4
Exec=wine "C:\\Program Files (x86)\\MetaTrader 4\\Terminal.exe"
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=false
ВЫПОЛНИТЬ СЦЕНАРИЙ ПЕРЕЗАГРУЗИТЬ МЕТАТРЕЙДЕР 4
nano /home/rapid_vn/restart_mt4.sh
#!/bin/sh
pkill Terminal.exe &
pkill terminal.exe &
env DISPLAY=:1 wine "C:\\Program Files (x86)\\MetaTrader 4\\Terminal.exe" &
СЦЕНАРИЙ ЗАПУСКА
mkdir /home/rapid_vn/.gnome
mkdir /home/rapid_vn/.gnome/gnome-schedule
mkdir /home/rapid_vn/.gnome/gnome-schedule/crontab
chmod u=rwx,g=rwx,o=rwx /home/rapid_vn/.gnome
chmod u=rwx,g=rwx,o=rwx /home/rapid_vn/.gnome/gnome-schedule
chmod u=rwx,g=rwx,o=rwx /home/rapid_vn/.gnome/gnome-schedule/crontab
nano /home/rapid_vn/.gnome/gnome-schedule/crontab/1
ver=5
title=Restart MetaTrader 4
desc=
output=0
display=0
command_d=sh /home/rapid_vn/restart_mt4.sh
echo 1 > /home/rapid_vn/.gnome/gnome-schedule/crontab/last_id
ИЗМЕНИТЬ ВРЕМЯ РАСПИСАНИЯ ЗАДАЧИ ВЫПОЛНЕНИЯ
su - rapid_vn
crontab -e
58 23 * * * sh /home/rapid_vn/restart_mt4.sh # JOB_ID_1
exit
reboot
Lo más probable es que su sistema cliente (desde el que está ejecutando telnet )no tenga habilitado TCP keepalive globalmente (y podría decirse que no debería ), y el sistema integrado no se está cerrando la conexión con gracia.
Este es un problema común con los servicios de red que generan procesos separados para cada sesión de usuario y luego no los terminan cuando el proceso principal se cierra (Sin embargo, en el otro lado de la moneda, puede reiniciar el servicio para una actualización sin afectar a los usuarios conectados, razón por la cual hacen esto en primer lugar ).
Puede habilitar keepalive solo para su conexión telnet aplicando algunas opciones en el socket. En lugar de codificar esto y recompilar el programa, simplemente puede usar una biblioteca existente libkeepalive .
Descargue el archivo tar fuente, libkeepalive-0.3.tar.gz
, y compile la biblioteca con el comando make
.
tar xvzf libkeepalive-0.3.tar.gz
cd libkeepalive-0.3
make
Tendrás un archivo libkeepalive.so
. Ahora puede ejecutar su telnet con la biblioteca pre -cargada. Hará los cambios apropiados a la función socket()
. Tiene 3 valores que puede establecer en el entorno, en cuanto al keepalive global. Por ejemplo,
LD_PRELOAD=$PWD/libkeepalive.so \
KEEPCNT=2 KEEPIDLE=2 KEEPINTVL=4 telnet hostname
Ahora, cuando el control remoto deje de responder a los paquetes keepalive, el comando telnet saldrá conConnection closed by foreign host.
Ver el archivo README
en las fuentes:
KEEPCNT <=> net.ipv4.tcp_keepalive_probes
KEEPIDLE <=> net.ipv4.tcp_keepalive_time
KEEPINTVL <=> net.ipv4.tcp_keepalive_intvl
Después de KEEPIDLE segundos, se enviará un paquete keepalive cada KEEPINTVL segundos. Después de los paquetes KEEPCNT sin respuesta, desconéctese.