Reply to topic

[SOLVED] How to run a logoff script

User avatar bushveld
Registered Member
Posts
174
Karma
0
OS

[SOLVED] How to run a logoff script

Thu Jan 08, 2009 7:21 am
Hello,

I'd like to run a logoff script when KDE shuts down. I there a method to do this?
I do NOT want that this logoff script runs on every user logoff. This script should run only when KDE is turned off. I have searced the tech base but I have not found what I am looking for - may be someone of the experts can help?

Thanks a lot
Michael

Last edited by bushveld on Sat Jan 10, 2009 8:23 pm, edited 1 time in total.


openSUSE 11.2 and KDE 4.4.0 -- Vita brevis! --
User avatar bcooksley
Administrator
Posts
19765
Karma
87
OS

RE: How to run a logoff script

Thu Jan 08, 2009 7:38 am
To KDE there is no difference between System Shutdown and User Logoff. the only difference is if the call made to KDM to perform a shutdown.

If the script does not require a graphical system, then you could add it to the list of commands for init to execute when the system begins to shutdown.

If it requires a graphical system, then you will need to discover how to find out what type of KDE shutdown ( system shutdown or standard logoff ) is being performed and act appropriately in a script that always executes on user logoff.


KDE Sysadmin
[img]http://forum.kde.org/content/bcooksley_sig.png[/img]
User avatar bushveld
Registered Member
Posts
174
Karma
0
OS

RE: How to run a logoff script

Thu Jan 08, 2009 7:56 am
Thanks

in kde3 there was a directory /opt/kde/share/shutdown is there something similar with kde4? (I am not sure about the (share), sorry have no more a kde3 system at hand.

Michael


openSUSE 11.2 and KDE 4.4.0 -- Vita brevis! --
User avatar bcooksley
Administrator
Posts
19765
Karma
87
OS

RE: How to run a logoff script

Thu Jan 08, 2009 8:08 am
From what I can find in the documentation, KDE 4 only executes *.desktop files, or scripts that are placed in the appropriate folders in $KDEHOME ( normally ~/.kde4 ) There is no system wide KDE shutdown scripts directory.

However, a complicated workaround should be possible, by making options immutable, custom scripts, etc.

The appropriate folders are "Autostart" and "shutdown" the contents of which can be managed with the "Autostart" control module is the advanced tab of system settings.


KDE Sysadmin
[img]http://forum.kde.org/content/bcooksley_sig.png[/img]
User avatar anda_skoa
KDE Developer
Posts
783
Karma
4
OS

RE: How to run a logoff script

Thu Jan 08, 2009 1:24 pm
bushveld wrote:in kde3 there was a directory /opt/kde/share/shutdown is there something similar with kde4? (I am not sure about the (share), sorry have no more a kde3 system at hand.


Yes, same mechanism in KDE4
Executables in KDEDIRS/shutdown are executed at the end of the startkde script.

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
arizonagroovejet
Registered Member
Posts
12
Karma
0

RE: How to run a logoff script

Mon Jan 19, 2009 12:24 pm
anda_skoa wrote:
Yes, same mechanism in KDE4
Executables in KDEDIRS/shutdown are executed at the end of the startkde script.


I've found this doesn't mean what I expected it to mean.
On openSUSE running KDE 4.1.3 there exists /usr/share/kde4/ and /etc/kde4/ so I would expect to be able to place a script in /usr/share/kde4/shutdown or /etc/kde4/shutdown and have that script run when a user logs out. However that doesn't work.

By adding a line in to /usr/bin/startkde and having it print out a list of the dirs it's looking for shutdown scripts in I found the output to be

/home/mike/.kde4/shutdown/
/usr/shutdown/

A script placed in /usr/shutdown does get run when a user logs out.

It seems completely illogical that KDE looks in /usr/shutdown and not /usr/share/kde4/shutdown or /etc/kde4/shutdown
User avatar bcooksley
Administrator
Posts
19765
Karma
87
OS
/usr/shutdown is likely a XDG location in case you are wondering.


KDE Sysadmin
[img]http://forum.kde.org/content/bcooksley_sig.png[/img]

 
Reply to topic

Bookmarks



Who is online

Registered users: ahmadmt, Baidu [Spider], Bing [Bot], claydoh, Google [Bot], grumpfel, jmacleod, PhobosK, Yahoo [Bot]