The Startup and Shutdown kcm provides an option to run a script when logging out. When I check that, however, the script seems not to be run on shutdown but when I log back in again and when I checked the settings, it was on Log in again.
Steps to Reproduce:
1. Create a script such as "kdialog --sorry 'shutting down'"
2. Add to Startup and shutdown kcm
3. Change "On Log in" to "On Log out"
4. Restart computer
Script is executed on logging in, and the setting has changed back to "On Log in"
The script is executed when logging out
Should be fixed in 4.9.4
*** This bug has been marked as a duplicate of bug 228795 ***