Run simple bash script to start applications at login

9,397

Go to System → Preferences → Startup Applications, then click Add. Under Command just enter spotify, instead of the script. There's no need to start a terminal for it.

screenshot, startup application preferences

If you need the output, you can change your script:

#!/bin/bash
echo "start spotify"
spotify > /home/username/spotify.log

and set it as the command, rather than Spotify itself.

Make sure the script is executable by opening the file's properties, going to permissions and setting "Allow executing file as program".

Share:
9,397
ganjan
Author by

ganjan

Updated on September 17, 2022

Comments

  • ganjan
    ganjan over 1 year

    I want to run a simple bash script automatically when I log in. For example

    #!/bin/bash
    echo "start spotify"
    gnome-terminal -e spotify --title spotify
    

    When I run this command, one gnome-terminal shows up and spotify show up. I also want the gnome-terminal to popup "hidden" in a different virtual desktop. (one of the other four virtual desktops you can choose from taskbar)

    I tried to add this to /home/me/.bash_login or something, but that didn't work..

    • flo
      flo about 13 years
      @Olli, that starts it every time you open a Terminal window :)
    • Olli
      Olli about 13 years
      @Stefano: or when you login from console, or over ssh. Whenever your shell is started. That's why I said "that's not good..."
  • Olli
    Olli about 13 years
    There might be multiple reasons for terminal. For example debug messages.
  • flo
    flo about 13 years
    @Olli, Thank you, I've edited my answer accordingly. This seems to me like the proper solution.
  • Olli
    Olli about 13 years
    yes, definitely. And of course you should use ~ instead of static path, so it'll work with any user :)