2

I want to start a wine application when system startup.

However this app need a Xwindow environment. I could only launch it manually by hand now, so I have to login first then start the app.

I have searched something about Xsession startup setting. I think applying that method would require a login. How can I start the app without login?

  • You have an application that uses X but you're running it through WINE? May I ask what program this is? – HalosGhost Jun 26 '14 at 6:35
  • Just an windows application with GUI & winsocks. @HalosGhost – Readon Shaw Jun 26 '14 at 6:45
1

You CAN'T start an X11 application without login. I think you mean you don't want to enter your username and password every time.

If this is the case, first, you should set up autologin on your display manager. Since you haven't provided any information on what DM do you use, I can't help with the exact instruction (anyway, a quick search will do).

Second, you have to add the wine command line to your WM/DE autostart file. The autostart file varies per WM/DE. Search for it.

This should do.

  • I am using lightdm as Debian default do. I want to use autologin, autostartup and lock screen function at the same time to work around this problem. But how to lock screen after my wine app launched. – Readon Shaw Jun 27 '14 at 4:07
  • You have to take a look at X screen lockers. There are plenty of them, my favorite is i3lock. Search for them. – psimon Jun 27 '14 at 8:25
-1

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

INSTALL TIGHT VNC SERVER

apt-get install tightvncserver

CHANGE USER

su - rapid_vn

SET PASSWORD FOR VNC SERVER WITH USER rapid_vn

vncpasswd

LOGOUT USER rapid_vn

exit

CONFIG VNC SERVER

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

MAKE AUTO START FIREFOX ON REBOOT

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

MAKE AUTO START MT4 ON REBOOT

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

MAKE SCRIPT RESTART METATRADER 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" &

MAKE TASK SCHEDULE RUN SCRIPT

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

EDIT TIME RUN TASK SCHEDULE

su - rapid_vn
crontab -e

    58 23 * * * sh /home/rapid_vn/restart_mt4.sh # JOB_ID_1

exit

reboot
  • WHY ALL CAPS? You can use bold if it is really necessary to draw extra attention. – Anthon Sep 29 '15 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.