LightDM calling session cleanup script on unlock.

Everything about X, Gnome, KDE, ... and everything running on it

LightDM calling session cleanup script on unlock.

Postby jmgibson1981 » 2018-09-27 13:35

I have a script that runs on login & logout through lightdm. This script loads / unloads a ramdisk for Minecraft. Sometimes I leave Minecraft running so my zombie farm can fill up. However when the screen locks it logs me out, removing the folders in the ramdisk. How can I make it just lock without running the session-cleanup-script in lightdm? AKA not logging out?
Last edited by jmgibson1981 on 2018-10-03 00:02, edited 2 times in total.
jmgibson1981
 
Posts: 74
Joined: 2015-06-07 14:38

Re: Disable logout on screensaver XFCE

Postby debiman » 2018-09-28 05:52

power manager settings?

PS: discarding what you told us about your minecraft zombie farm, there really isn't much info in your OP.
User avatar
debiman
 
Posts: 2927
Joined: 2013-03-12 07:18

Re: Disable logout on screensaver XFCE

Postby Danielsan » 2018-09-28 16:11

Is the problem with lightdm (light-locker) or with Xscreensaver?

If you need to disable the former here the solution: viewtopic.php?t=129607
User avatar
Danielsan
 
Posts: 488
Joined: 2010-10-10 22:36

Re: Disable logout on screensaver XFCE

Postby jmgibson1981 » 2018-10-02 02:42

Sorry it took me a few days. I didn't know what information to include. However I have found that my script was in error. Nothing is wrong with lightdm. Rewrote and been testing all afternoon. Not a hitch. Got it wrapped up. Sharing script as my solution for anyone who may need it to ramdisk minecraft easy enough.

Code: Select all
#!/bin/bash
# tadaen sylvermane | jason gibson
# minecraft ramdisk loader

## main source ##

. /usr/local/bin/desktopsource

## main setup ##

bin_links mcramdisk userload

## variables ##

RAMDISKDIR=/ramdisk
DATARESOURCE=/data/minecraft/resourcepacks
RAMDISKRESOURCE="$RAMDISKDIR"/resourcepacks
RAMDISKGID=2000

## begin script ##

user_loader() {
   if [[ ! -e "$RAMDISKDIR"/"$USER"/.minecraft ]] ; then
      if [[ -e /data/"$USER"/.minecraft ]] ; then
         mkdir -p "$RAMDISKDIR"/"$USER"/.minecraft
         rsync -auv --progress --exclude=resourcepacks /data/"$USER"/.minecraft/* "$RAMDISKDIR"/"$USER"/.minecraft/
         ln -s "$RAMDISKRESOURCE" "$RAMDISKDIR"/"$USER"/.minecraft/
         if [[ ! -h /home/"$USER"/.minecraft ]] || [[ $(readlink /home/"$USER"/.minecraft) != "$RAMDISKDIR"/"$USER"/.minecraft ]] ; then
            rm -r /home/"$USER"/.minecraft
            ln -s "$RAMDISKDIR"/"$USER"/.minecraft /home/"$USER"/
         fi
      fi
   else
      rsync -auv --progress --exclude=resourcepacks "$RAMDISKDIR"/"$USER"/.minecraft/* /data/"$USER"/.minecraft/
      rm -r "$RAMDISKDIR"/"$USER"
   fi
}

case "$SCRIPTCALL" in
   mcramdisk)
      if ! mountpoint -q "$RAMDISKDIR" ; then
         if [[ "$USER" == root ]] ; then
            if ! grep "$RAMDISKDIR" /etc/fstab ; then
               mkdir -p "$RAMDISKDIR"
               echo "#minecraft ramdisk
none ${RAMDISKDIR} tmpfs defaults,size=2048M,gid=${RAMDISKGID} 0 0" >> /etc/fstab
               groupadd --gid "$RAMDISKGID" $(basename "$RAMDISKDIR")
               for user in /home/* ; do
                  usermod -aG $(basename "$RAMDISKDIR") $(basename "$user")
               done
            fi
            mount "$RAMDISKDIR"
         else
            echo "must be root for setup!"
            exit 0
         fi
      fi
      if [[ ! -e /ramdisk/resourcepacks ]] ; then
         rsync -auv --progress "$DATARESOURCE" "$RAMDISKDIR"
      else
         rsync -auv --progress "$RAMDISKRESOURCE"/* "$DATARESOURCE"
      fi
      ;;
   userload)
      case $(basename $(cat /etc/X11/default-display-manager)) in
         lightdm)
            export RAMDISKDIR="$RAMDISKDIR"
            export RAMDISKRESOURCE="$RAMDISKRESOURCE"
            export -f user_loader
            su -c "user_loader" "$USER"
            ;;
         sddm|gdm3)
            user_loader
            ;;
      esac
      ;;
esac

## end script ##
jmgibson1981
 
Posts: 74
Joined: 2015-06-07 14:38

Re: [Solved] Disable logout on screensaver XFCE

Postby debiman » 2018-10-02 05:58

so this thread was about minecraft all along...
:roll:
User avatar
debiman
 
Posts: 2927
Joined: 2013-03-12 07:18

Re: [Solved] Disable logout on screensaver XFCE

Postby jmgibson1981 » 2018-10-02 10:37

I use session-cleanup & session-setup in lightdm to fire the script off for whichever user. At the time it appeared to be running even though I wasn't logging out. Not about Minecraft, rather about my error in the cause of the problem.
jmgibson1981
 
Posts: 74
Joined: 2015-06-07 14:38

Re: [Solved] Disable logout on screensaver XFCE

Postby jmgibson1981 » 2018-10-02 23:58

Removed solved tag. I found the source here. I don't know enough to try to fix it myself. But just an fyi, if anyone has any workarounds. The bug report shows them ignoring it so it isn't a popular problem I guess. I have worked around by eliminating screen locking altogether, however clearly not an ideal workaround.

https://bugs.launchpad.net/ubuntu/+sour ... ug/1374379
jmgibson1981
 
Posts: 74
Joined: 2015-06-07 14:38


Return to Desktop & Multimedia

Who is online

Users browsing this forum: No registered users and 6 guests

fashionable