User Tools

Site Tools


en:tipps:autostart

AUTO Start of programs after booting:

If you want to start a program automatically right after booting, this is more difficult than you think, because unfortunately the procedure is strongly system dependent. What works on one device may not work on another.

Therefore, the following always applies only to the specified computer:

Odroid with Ubuntu Mate:

Starting a program as a normal user (e.g. "odroid"):

for this you need a *.desktop file in the directory /home/odroid/.config/autostart. This directory does not exist by default, so you have to create it. The procedure is as follows:

1) cd /home/odroid/.config

2) mkdir autostart

3) now the autostart file is created, in this example I start x11vnc. To do this you have to create a new file in /home/odroid/.config/autostart with the extension .desktop, e.g.: x11vnc.desktop. You open such a file with an editor and then insert the following content:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=x11vnc
Comment=start x11vnc
Exec=x11vnc
Hidden=false
NoDisplay=false
Terminal=false

The important thing is: Exec=x11vnc , here you specify the executable file which should be started automatically.

4) the .desktop file just created must be executable. Therefore enter: chmod 755 x11vnc.desktop

important to know is, with the above procedure you start the desired program (in this case x11vnc) as a normal user (not as root), which is important for x11vnc.

Start a program as root:

Programs that should be started as root are almost 100% programs without GUI, so they run without user interface.

There are different methods for autostart which mainly depend on “when” you want to start. In many cases an entry in rc.local is the easiest solution.

in this example I want to start the program WebWSPR. This has the file path/name /home/odroid/wspr2/wsprtk, must run as root and needs no user interface.

1) Example: Start the wsprtk.\ program. Create a script which starts the desired program:

Scriptname: /home/odroid/wspr2/startwspr

Content:
cd /home/odroid/wspr2
./wsprtk

2) enter this script in rc.local: there write at the top (under the /bin/bash): /home/odroid/wspr2/startwspr

don't forget to make the script executable: chmod 755 /home/odroid/wspr2/startwspr

If you reboot now the program will be executed. If it does not run, there was an error at startup, in this case it is useful if the program to be called writes a log file where you can check what happened.

Autostart as root under Diet-PI

Invoking the utility: sudo dietpi-launcher

Selection: DietPI autostart
Selection: Custom - /var/lib…..
Exit - Exit

sudo nano /var/lib/dietpi/dietpi-autostart/custom.sh

At the end of the file enter the program you want to start. It will be started as root

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
en/tipps/autostart.txt · Last modified: 2021/07/18 14:38 by kurt