LXQt Session Settings/Autostart but Shutdown

(James) #1

I need to run a script when the computer is shutdown.

LXQt Session Settings/Shutdown would be perfect but it is not there.

Is there a way to run something at shutdown?

(Stefano) #2

This can be done by the display manager, sddm, the scripts have to be saved in /usr/share/sddm/scripts/Xsetup or …Xstop (for shutdown).

(James) #3

Do you mean append to the Xstop script?

ls -l /usr/share/sddm/scripts/Xstop -rwxr-xr-x 1 root root 167 Jul 27 2018 /usr/share/sddm/scripts/Xstop

$ sudo cat /usr/share/sddm/scripts/Xstop #!/bin/sh

Xstop - run as root after stopping X

if [ -e /sbin/prime-switch ]; then echo running NVIDIA Prime switch /sbin/prime-switch /sbin/prime-switch fi

(Stefano) #4

Yeah, didn’t remember that it was a file and not a directory.

(James) #5

Does putting a script there timeout? I tried to run a backup script but it didn’t copy all the files it should have.

(James) #6

I’m pretty sure it doesn’t block the shutdown until it is finished.