to play sound from a script/bash/command line: there are multiple possibilities…
hostnamectl; # tested on Static hostname: DebianLaptop Icon name: computer-laptop Operating System: Debian GNU/Linux 9 (stretch) Kernel: Linux 4.9.0-11-amd64 Architecture: x86-64 # paplay seems to be part of the package: apt install pulseaudio-utils; # Befehlszeilenwerkzeuge für den Soundserver PulseAudio paplay Debian_Linux_Startup_Linux_Sound_Collection.ogg # or with absolute paths: /usr/bin/paplay /path/to/Debian_Linux_Startup_Linux_Sound_Collection.ogg # alternative: vlc apt install vlc # if you have vlc player installed (apt-get install vlc) cvlc --play-and-exit Debian_Linux_Startup_Linux_Sound_Collection.ogg # problem: if one has configured vlc to loop the playlist # it might not exit but keep repeating the sound
how to trigger sound play?
it definitely needs to happen as the user that is also is running/logged in to the x session/desktop otherwise one will get:
/scripts/start.sh Connection failure: Connection refused pa_context_connect() failed: Connection refused
under MATE and Cinnamon Desktop simply search for “startup applications” widget and add like this: