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). > I also added the line in the file /etc/rc.local: > mousepad Make sure /etc/rc.local is executable, and has a #!/bin/sh header line. Beyond that, I am not familiar with "mousepad". It doesn't sound like the kind of program that can be run as a background service daemon. What does it actually do? Does it interact with X11 in some way? If it does, then this is not the place to launch it. > But the program doesn't launch at startup. Where I am going wrong? > Does it fail to start because the command is run before the GUI starts > up? If it's GUI-related, then yes. You can't do this from rc.local. > I don't want to use cron by editing crontab -e. I tried @reboot > mousepad, but doesn't work. If it's GUI-related, you can't do it from crontab either. 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. Debian created another file called .xsessionrc which you can use instead, even if your don't use an .xsession file. 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. 2) Create a ~/.xsessionrc file containing the commands you want to run while starting your X session. 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 & See also: https://wiki.debian.org/Xsession