On Mon, May 15, 2023 at 09:37:29PM +0200, Vincent Lefevre wrote:
> 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.

That's incorrect.

===========================================================================
unicorn:~$ systemctl cat rc-local.service | cat
# /lib/systemd/system/rc-local.service
#  SPDX-License-Identifier: LGPL-2.1-or-later
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.local is executable.
[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no

# /lib/systemd/system/rc-local.service.d/debian.conf
[Unit]
# not specified by LSB, but has been behaving that way in Debian under SysV
# init and upstart
After=network-online.target

# Often contains status messages which users expect to see on the console
# during boot
[Service]
StandardOutput=journal+console
StandardError=journal+console
===========================================================================

You can claim that using rc.local is a bad practice, and I won't argue
against you.  But this unit *is* provided by Debian (including Debian's
own little patch, which you can see at the end of the output above), and
if you want to use rc.local at all, this is how it's done.

Of course, this is all irrelevant to the OP's implied goal of running
an X11 client program at user login.

Reply via email to