Running a Script After Startx Automatically

Run shell script after XServer is started?

According to this link .xinitrc in your home directory will be read and executed, otherwise the default /etc/X11/xinit/xinitrc is used. So you should be able to create this file and have the shell script started.

How do I automatically start an application that needs X in Linux

Rather than defining an init script, you should be having X (or your window manager) start the process automatically. X, KDE, and Gnome all have ways of automatically starting things up (i.e. ~/.kde4/Autostart).

If this IS just X, go modify your /etc/X11/xinit/xinitrc file (or equivalent) to have it run your command. Mine looks like this at the bottom of the file:

if [ -n "$failsafe" ]; then
twm &
xclock -geometry 50x50-1+1 &
xterm -geometry 80x50+494+51 &
xterm -geometry 80x20+494-0 &
exec xterm -geometry 80x66+0+0 -name login
else
exec $command
fi

So you would change that to run whatever command you want.

Execution of some command every time a xerser starts: Turn on keyboard leds on startup by `xset led led on`

You could edit the /etc/rc.local file which will be executed after boot and run level changes. You can just throw the command right in there. You may also be able to use ~/.xinitrc or ~/.xsession depending on your specific setup (I'm not familiar with Ubuntu Mate).



Related Topics



Leave a reply



Submit