Update: there is no rc.local per default no more

since debian 9.5 stretch you will have to recreate it.

vim /etc/rc.local 
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

echo "test if this is run at startup" > /etc/rc.local.log;

exit 0

then go:

chmod +x /etc/rc.local
systemctl daemon-reload
systemctl start rc-local
systemctl status rc-local

 

the systemctrl service unit way: (more effort)

14

I saw this solution suggested which involves use of

systemd

here:

  1. Create a service:
    sudo vi /etc/systemd/system/rc-local.service
    
  2. Add your code there:
    [Unit]
    Description=/etc/rc.local Compatibility
    ConditionPathExists=/etc/rc.local
    
    [Service]
    Type=forking
    ExecStart=/etc/rc.local start
    TimeoutSec=0
    StandardOutput=tty
    RemainAfterExit=yes
    SysVStartPriority=99
    
    [Install]
    WantedBy=multi-user.target
    

LXDE:

if you wanna autostart services that start before the desktop (non-grafical like mounting stuff) you can put them here:

Autostart files in an LXDE desktop and/or Openbox can be located in at least 5 places, depending upon the distro. These are

   /etc/xdg/lxsession/LXDE/autostart
   /etc/xdg/openbox/autostart
   ~/.config/openbox/autostart.sh
   ~/.config/autostart
   /etc/xdg/autostart.

The first three are text files that are edited by adding text according to some format, and the last two are directories containing .desktop files for the processes that are to be started. If the lxde-core desktop is installed, then the lxde-autostart usually takes precedence in the command order. In an openbox-only distribution with no session-manager, generally ~/.config/autostart.sh rules. The two autostart files in the user’s home directory (~/) only apply to that user; the 3 in the etc directory apply to all users.

vim /etc/rc.local; # global-system-wide on every debian BEFORE DESKTOP
vim /etc/xdg/lxsession/LXDE/autostart; # for programs that start AFTER DESKTOP (LXDE) has started "autostart"
sudo vim ~/.config/lxsession/LXDE/autostart

@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@xscreensaver -no-splash
@icedove
@lxterminal -e /scripts/SetScreen.sh

i don’t know which one worked… but it worked after:

echo "@lxterminal -e /scripts/welcome.sh" >> /etc/xdg/lxsession/LXDE/autostart;
echo "@lxterminal -e /scripts/welcome.sh" >> /etc/xdg/openbox/autostart;
echo "@lxterminal -e /scripts/welcome.sh" >> ~/.config/openbox/autostart.sh;
echo "@lxterminal -e /scripts/welcome.sh" >> ~/.config/autostart;
echo "@lxterminal -e /scripts/welcome.sh" >> /etc/xdg/autostart;
admin