Re: How to run a command / script on startup automatically in linux?
On 2023-05-15 15:56:17 -0400, Greg Wooledge wrote:
> 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.
It is correct, as shown by the following command:
zira:~> dlocate etc/rc.local
initscripts: /etc/rc.local
Ditto with "apt-file search etc/rc.local".
> You can claim that using rc.local is a bad practice,
This is not what I'm saying. I'm saying that using it in a way that
it incompatible with initscripts (which provides the file) is a bad
idea. Note that the user might want to install later a package that
would depend on it, and things could break in obscure ways.
--
Vincent Lefèvre <vincent@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 to: