Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
  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.

share|improve this question

migrated from stackoverflow.com Jun 8 '12 at 14:49

This question came from our site for professional and enthusiast programmers.

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

2 Answers 2

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:

http://fluxbox.sourceforge.net/docbook/en/html/app-setup.html

share|improve this answer

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

#!/bin/zsh
#Map Capslock to ESC
setxkbmap -option caps:escape &
#Wallpaper
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
#font
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
do
  xsetroot -name "nXqd"
    sleep 20s
done &
#Window manager
exec dwm
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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