Start script bash on start system/session

Ok, I had to try this out myself (after reading the Spanish thread on this subject). Works as intended, I'd say:

What I did:

  1. Copy-pasted the script from your code above to /home/myusername/Lataukset/Pruebas.sh (Lataukset = Descargas in Finnish, the localized Downloads folder).
    #!/bin/bash sleep 10 notify-send "Se ha iniciado el sistema" --expire-time=14000 sleep 15 exit

  2. I made the script executable by the user (chmod 744 ~/Lataukset/Pruebas.sh)

  3. Added the script to Startup applications:

  1. Rebooted.

The notification appeared after 10 seconds of sleep, as intended - 5 seconds before my Conky came up (it's set to wait for 15 seconds).

1 Like

If i can find the place where i saw instructions about how to post some code, i’ll offer a possible solution, if i can find this thread again. Note to self: post contents of file “/etc/init/local_boot_init.conf”

/etc/init directory is for scripts used by Upstart, init system no longer in active use in Ubuntu.

Upstart was Canonical’s own init system, created to replace the venerable sysvinit (SysV) that served us well since 1983. Upstart was introduced in 6.10 (Edgy Eft) and became the default init system in 9.10 (Karmic Koala). In 2014 Debian announced they will follow all other main distros and adopt systemd, so Canonical decided to migrate from Upstart to systemd as well. Systemd became the default init system for Ubuntu in 15.04 (Vivid Vervet).

Upstart could run unmodified sysvinit init scripts in /etc/rc* directories making migration easier. It also executed rc.local (another sysvinit thing) where you could dump commands for things you want to run at boot time.

Upstart’s /etc/init and sysvinit’s runlevel directories /etc/rc* still remain, but they will be removed eventually. It’s just a matter of time.

Therefore I suggest again: use systemd unit files for things you need to start at boot time and autostart for things that need to run at (desktop) session start.

Those are current technologies, used by other main distros and desktops as well. Upstart was pretty much a Canonical (Ubuntu) only thing.

Further reading:
https://en.wikipedia.org/wiki/Init#SYSV
https://en.wikipedia.org/wiki/Upstart#Adoption

2 Likes

Oh, sorry, i just remember using that config file with ubuntu 11.10 and thought it might still work.