1. Where should I put a bash script if I want it to be executed once during X startup as part of system bootup. For example, I want to start up VPN on my machine as root user once X starts up.

  2. When X initializes (lets say GDM in my case) or when a user logs in using a DM (desktop manager) is it considered a login shell?

  3. Also I would like to run programs as long as I am logged in using X. For example, I want to run Dropbox as long as I am logged in using Gnome.

  • 1
    For your question 1, should be in /etc/rc5.d. See this table for the various run levels – karthik Jun 8 '12 at 11:50
  • 1
    Any attempts to read manuals there? – poige Jun 9 '12 at 4:14

Anything you want to run when a user logs into an X session, you want to put in the .xinitrc or .xsession file in the user's $HOME.

This page has a pretty good explanation:



You should put them in .xinitrc . This is mine :

#Map Capslock to ESC
setxkbmap -option caps:escape &
feh --bg-scale /mnt/data/Dropbox/pic/character/samurai.png
#turn off beep sound
xset -b
#mouse speed
xset m 1/5
#keyboard repeat speed
xset r rate 200 30
xset +fp /usr/share/fonts/local
xset fp rehash
#urxvtd daemon
urxvtd -q -f -o &
#Disable touchpad tapping and scrolling when typing
syndaemon -t -i 2 &
#Hide cursor
unclutter -keystroke &
#Redshift - change your screen temp to reduce eyestrain
redshift &
# Dropbox
dropboxd &
#dwm status
while true
  xsetroot -name "nXqd"
    sleep 20s
done &
#Window manager
exec dwm

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.