user logout script?

Forum Forums General Software user logout script?

  • This topic has 3 replies, 2 voices, and was last updated Dec 15-9:51 pm by Anonymous.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3827
    Member
    ckhung

      Hi,

      I figured out that one can put into ~/.desktop-session/startup whatever commands one wishes to execute upon login. What is the corresponding user script file that will be executed upon logout?

      This seems to be the system script file upon logout: /usr/local/lib/desktop-session/desktop-session-logout but I cannot find any user script that it calls.

      I need to do this because Profile-sync-daemon is designed to work with systemd and not the original “service psd startup” commands that antix17 uses. According to /usr/share/doc/profile-sync-daemon/README.Debian we therefore need to manually put the resync and unsync commands in some login and logout scripts.

      Thanks in advance!

      #3855
      Anonymous
        Helpful
        Up
        0
        ::

        Within ~/.fluxbox/menu we can see that the “Exit” command calls desktop-session-exit
        /usr/local/bin/desktop-session-exit
        ^— untested, but I expect you can insert your call to resync (or, maybe profile-sync-daemon needs calls to both resync AND unsync?) within the shutdown (and other) case

        Separately, to catch “Desktops }} OtherDesktops }}}” events, you’ll probably want to also insert those custom calls within
        /usr/local/lib/desktop-session/desktop-session-restart

        (FWIW, those scripts also source /usr/local/lib/desktop-session/desktop-session-logout )

        .
        edited to add:
        probably unwise (or pointless) to “catch “Desktops }} OtherDesktops }}} events”, eh?
        profile-sync-daemon resync” calls running_check()

        #3863
        Member
        ckhung
          Helpful
          Up
          0
          ::

          Well I don’t mind sacrificing some efficiency for data integrity. So it will be fine with me if psd cleans things up (saves browser profiles from RAM back to disk) upon logout, window manager restart, switching window manager, or shutdown, and then immediately gets called again to move them back to RAM in the case of window manager switch or restart. So it would be better if I put these two commands in two symmetric-looking scripts. I hesitate about putting psd resync in ~/.desktop-session/* while putting psd unsync in each window manager’s own config file. (In my case ~/.icewm/preferences => LogoutCommand, right?)

          While we are at it, do you know the difference between /usr/local/lib/desktop-session/desktop-session-logout and /usr/local/bin/desktop-session-exit ?

          Thank you skidoo!

          #3865
          Anonymous
            Helpful
            Up
            0
            ::

            putting psd unsync in each window manager’s own config file. (In my case ~/.icewm/preferences => LogoutCommand, right?)

            I would avoid attempting to redundantly “deal with” (inject) the customization within each window manager config.
            Earlier, I only mentioned ~/.fluxbox/menu because it was (is) the starting point for researching “which executable is called when I “Logout”? and when I “Exit”?)

            in the case of window manager switch

            Upon reflection, I realize that “Desktops }} OtherDesktops }}}” should not cause a problem.
            During that event, the browser is not killed / restarted (only the window manager & autostarted item(s) processes are killed and restarted).

            My concern regarding data integrity stems from the fact that firefox needs several seconds to finish its cleanup+housekeeping after the application window exits.
            profile-sync-daemon has been battle-tested across the span of a year or more; hopefully the running_check() routine allows adequate delay.
            If it does not, the consequences would be evident upon next restart of the browser (with session manager reporting “oops — your last session crashed”)

            difference between /usr/local/lib/desktop-session/desktop-session-logout and /usr/local/bin/desktop-session-exit

            Dave is the author / maintainer of the antiX antiX desktop-session scripts.
            He may notice this topic and post to provide a definitive answer (or click Dave and send him a message to inquire).

            In the meantime, instead of wording “difference between”, I’ll explain how I arrived at the suggestion (where to inject) in my earlier post.

            Tracking down “when is X called, vs when is Y called”…
            $ which desktop-session-exit
            $ sudo locate desktop-session-exit (on your system, sudo might not be needed here)

            cd /usr/local/bin
            grep -ir “desktop-session-logout”
            grep -ir “desktop-session-exit”

            cd /usr/local/lib
            grep -ir “desktop-session-logout”
            grep -ir “desktop-session-exit”

            a more through tack: search the github repository
            https://github.com/antiX-Dave/desktop-session/search?utf8=%E2%9C%93&q=exit&type=
            (15 occurrences)
            https://github.com/antiX-Dave/desktop-session/search?utf8=%E2%9C%93&q=logout&type=
            (8 occurrences)

            We can see the code within ds-exit.py called when a button displayed in the exit dialog is clicked

            self.build_button(ICONS+"/lock.svg","Lock Screen","desktop-session-exit -L","left")
            self.build_button(ICONS+"/hibernate.svg","Hibernate","desktop-session-exit -h","left")
            self.build_button(ICONS+"/reboot.svg","Reboot","desktop-session-exit -r","left")
            self.build_button(ICONS+"/logout.svg","Log Out","desktop-session-exit -l","right")
            self.build_button(ICONS+"/suspend.svg","Suspend","desktop-session-exit -S","right")
            self.build_button(ICONS+"/shutdown.svg","Shutdown","desktop-session-exit -s","right")
            self.build_button(ICONS+"/upgrade.svg","Restart Session","desktop-session-exit -R","main")
          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.