On 2023-05-15 13:42:52 -0400, Greg Wooledge wrote:
> On Mon, May 15, 2023 at 10:44:37PM +0530, Susmita/Rajib wrote:
> > 
> > I saved a file at "/etc/systemd/system/" named "rc-local.service" with
> > the following lines:
> > ------------------------------------------------
> 
> There's no need to do that.  Debian already ships an rc-local.service.
> 
> All you need to do is create an /etc/rc.local file, make it executable,
> and make sure it's a valid shell script (with a shebang and all that).

This is a bad idea. The /etc/rc.local file is provided by the
initscripts package. I would suggest to either install this
package and use it in the way it is intended or create your
own service.

> A GUI-related program has to be run after you launch your GUI session.
> Traditionally, this is accomplished by adding it to your .xsession file,
> if you wrote your own .xsession file.  But most Desktop Environment
> users don't do that.  They don't have a personal .xsession file at all.

The .xsession file entirely replaces the desktop environment or
window manager. See /etc/X11/Xsession.d/50x11-common_determine-startup
and the Xsession(5) man page. This is useful to run configuration
utilities before explicitly running the window manager at the end.

> Debian created another file called .xsessionrc which you can use instead,
> even if your don't use an .xsession file.

But note that programs run from .xsessionrc may be run too soon
(before other settings from /etc/X11/Xsession.d). The .xsessionrc
file should only be used to set up environment variables and things
like that.

> So, here's what I'd suggest:
> 
> 1) Get rid of your /etc/systemd/system/rc-local.service file.  It's not
>    needed, and will just cause confusion.

Agreed.

> 2) Create a ~/.xsessionrc file containing the commands you want to run
>    while starting your X session.

This depends on the commands. GUI applications like mousepad should
not be run from it. They should be run by the DE or WM. If this is
not possible, run them just before via a ".xsession" file.

> 3) Double-check that this "mousepad" command can be run in the way you're
>    running it.  Does it self-background?  If not, then you need to put
>    an ampersand after it:
> 
>    mousepad &

Note that if it is run by the DE or WM (recommended way as this
may benefit from the DE/WM features), there is probably no need
for the "&".

> See also: https://wiki.debian.org/Xsession

The man page is more detailed.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to