[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: startup script



On Sun, Jul 01, 2012 at 02:05:47PM BST, Tony van der Hoff wrote:
> Thanks, Claudius. This is primarily for KDE, but I would expect it to
> work for a console login as well. Does KDE try to run ~/.bashrc or
> ~/.profile?

No it doesn't.

Desktop Environments or Window Managers do not run $SHELL startup
files, nor should they.

> The reason I asked here is because I previously tried doing exactly what
> you suggest by putting a link in ~/.kde/Autostart to the script, but it
> doesn't appear to work.

In KDE4 the directory in question is $XDG_CONFIG_HOME/autostart [0] or
$KDEHOME/Autostart [1].

> I don't appear to have ~/.bashrc nor ~/.profile.

Startup files in Bash are a bit of a mess [2] and, contrary to what
others have written here, .bashrc is not read during login (unless
sourced by other files obviously) and if you only log in using X then
you don't need either of those files anyway.

> Perhaps more detail is required.

Perhaps.

> I have a script named ~/scripts/start-socks-proxy.sh, containing:
> -------------------------------
> #! /bin/bash
> ssh -CNfqD8080 tony@xxxx.org.uk
> -------------------------------
> 
> This works fine when invoking from a terminal, or when double-clicking
> in konqueror.

There's no reason why it shouldn't.

> As mentioned, I have a link to that script in ~/kde/autostart.
> Unfortunately it doesn't autostart.

And it won't.

P.S. If you'd like your script to run both from X and console login,
put it in KDE's autostart folder and run it from .bash_profile,
.bash_login or .profile (in that order as Bash will stop searching for
the other ones after the first success - told you it's a bit of a mess
;^)

P.P.S. Tony, you sent an email with very little information and got
very imprecise replies. Next time please post one with all required
details, i.e. what kind of login, console or X (and if the latter what
DE or WM), and what are you trying to achieve (i.e. script run at
every shell invocation or only once at logon - .bashrc is the wrong
place to put it BTW). Had you done that the first time around you
might have gotten the right answer to your question the first time
around, otherwise it a bit of a waste of time for us - my crystal ball
doesn't work very well on Sundays for example [3].

[0] if $XDG_CONFIG_HOME is not set it defaults to $HOME/.config
[1] if $KDEHOME is not set it defaults to $HOME/.kde4
[2] http://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/
[3] http://tools.ietf.org/html/rfc1855

Kind regards,
-- 
rjc


Reply to: