Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux equivalent of Windows "Startup" folder

I want to run a program when my embedded Linux's desktop has started up, in the same way as Windows runs programs in the "Startup" folder. How can I do this?

Specifically, my target hardware is Beaglebone Black, the Debian variant (rev C board). The Window Manager is the default one.

like image 621
Julian Gold Avatar asked May 05 '15 14:05

Julian Gold


People also ask

Where is the shell startup folder?

With the file location open, press the Windows logo key + R, type shell:startup, then select OK. This opens the Startup folder.

Where is system startup file stored?

Accessing The Windows 10 Startup Folder Open the File Explorer and drop one of the following paths into the Quick access bar. The All Users Startup Folder is located at the following path: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp.

What is shell startup in Windows?

These programs start up for all users. To open this folder, bring up the Run box, type shell:common startup and hit Enter. Or to open the folder quickly, you can press WinKey, type shell:common startup and hit Enter. You can add shortcuts of the programs you want to start with your Windows in this folder.


2 Answers

In Linux these are called init scripts and usually sit in /etc/init.d. How they should be defined varies between different distros but today many use the Linux Standard Base (LSB) Init Script format.

Good readings on this: https://wiki.debian.org/LSBInitScripts https://www.debian-administration.org/article/28/Making_scripts_run_at_boot_time_with_Debian

like image 182
marekful Avatar answered Sep 25 '22 22:09

marekful


There are multiple ways to start a program, it turns out. LXDE - the window manager - supports auto-start of .desktop files places in either ~/.config/autostart or /etc/xdg/autostart - hooray!

http://wiki.lxde.org/en/Autostart

Except... though I can run a simple program as proof-of-concept in this way, when I try to run mine, it fails. I can't figure out why. The file

.xsession-errors.old

contains X server errors ("resource temporarily unavailable").

I am now using another mechanism - running the code from a shell script (this is necessary because I need to specify a working directory for the program). This uses the "autostart" file in /etc/xdg/lxsession/, and at least it works. Well kind of. I either have to "sleep 5" before running, or prefixing the run with an @ symbol which forces a retry if it fails. It looks a little like something my code is dependent on is not in place at the precise time the autostart mechanism finds it. I can find no way of ensuring startup order. This is plainly a crock of stinky stuff.

like image 34
Julian Gold Avatar answered Sep 24 '22 22:09

Julian Gold