0

This is my first question on here so please don't destroy me, i would like to enable a logging off sound when turning off or restarting Ubuntu, i have some custom sounds installed and have managed to get system ready and logging ON to work, however all questions i have looked for regarding this are over 6 years old and don't actually address what I'm trying to do. I have a few different .ogg files and have basically deleted the old ones and pasted in the new.

Thanks.

  • See askubuntu.com/questions/293312 , and look for the excellent systemd-related answer, for how to trigger an event upon logout in 16.04 and newer releases of Ubuntu. – user535733 Feb 19 '17 at 14:31
0

You can use the program music123 to play the sound

sudo apt install music123

Then create a init file to trigger a file to play

sudo nano /etc/init.d/K01sdsound.sh

In that file do something like

#!/bin/sh
/usr/bin/music123 /yourpath/yourfile.format

Make your file executable

sudo chmod +x /etc/init.d/K01sdsound.sh

Test your file

/etc/init.d/K01sdsound.sh

Now that your file plays a song or sound you need to tell it to run on logoff you can add it to your lightdm config, lets create a new config file

sudo nano /usr/share/lightdm/lightdm.conf.d/50-sdsound.conf

add to this new file

[SeatDefaults]
session-cleanup-script=/etc/init.d/K01sdsound.sh

You now have sound on logoff

Or if you want it on shutdown create a symbolic link from your file to /etc/rc0.d so your system runs it on shutdown either/also

sudo ln -s /etc/init.d/K01sdsound.sh /etc/rc0.d/K01sdsound.sh
  • Answers for new versions of Ubuntu should use systemd, not init. – Nonny Moose Feb 19 '17 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.