Thursday, May 2, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 2669  / 1 Year ago, wed, november 16, 2022, 3:12:46

I'm pretty new to Ubuntu and recently ran into an interesting issue. I installed Keep Presence (https://github.com/carrot69/keep-presence) to prevent my Intel Compute Stick from idling. What I would like to do is have this launch when Ubuntu starts. I looked around and saw you could add your commands to rc.local, so I ran sudo nano /etc/rc.local and added keep-presence --seconds 30 to rc.local, but I don't think that did anything. After saving, I re-opened to confirm the line I added was still there, just in case I did that wrong. Is there a way to tell if it's working or am I doing this completely wrong? When I restart, everything starts up like normal, so I'm not seeing an error or anything. But a terminal window doesn't open or anything like that, which would give me peace of mind knowing it's working. My version is Ubuntu 20.04.3 LTS Any ideas?


Thanks,

Josh


More From » command-line

 Answers
7

First: in new Ubuntu versions, the file /etc/rc.local does not work anymore. If you want to run something at system startup, you should add it to the crontab (see man 5 crontab) using @reboot time specification.


Second: you cannot run a command that interacts with the desktop that way, because of two reasons: a) when the system starts, your GUI desktop is not ready yet, so there's simply no place where the application window could be displayed; b) a command that runs from crontab (or /etc/rc.local, if it would work) does not share the environment with your desktop session, so is missing important system variables required for GUI applications to work.


The solution is to add your application to "Startup Applications" in your desktop session (there's a special tool for that) - then your application will start together with your desktop session when you log in.


[#1226] Wednesday, November 16, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
arkcker

Total Points: 296
Total Questions: 111
Total Answers: 104

Location: Nepal
Member since Tue, Sep 8, 2020
4 Years ago
arkcker questions
Tue, Aug 17, 21, 00:08, 3 Years ago
Sun, May 14, 23, 01:04, 1 Year ago
Tue, Jun 1, 21, 01:29, 3 Years ago
;