Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

LightDM calling session cleanup script on unlock.

Graphical Environments, Managers, Multimedia & Desktop questions.
Post Reply
Message
Author
jmgibson1981
Posts: 296
Joined: 2015-06-07 14:38
Has thanked: 11 times
Been thanked: 32 times

LightDM calling session cleanup script on unlock.

#1 Post by jmgibson1981 »

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.

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Disable logout on screensaver XFCE

#2 Post by debiman »

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
Danielsan
Posts: 659
Joined: 2010-10-10 22:36
Has thanked: 5 times

Re: Disable logout on screensaver XFCE

#3 Post by Danielsan »

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

If you need to disable the former here the solution: http://forums.debian.net/viewtopic.php?t=129607

jmgibson1981
Posts: 296
Joined: 2015-06-07 14:38
Has thanked: 11 times
Been thanked: 32 times

Re: Disable logout on screensaver XFCE

#4 Post by jmgibson1981 »

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 ##

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: [Solved] Disable logout on screensaver XFCE

#5 Post by debiman »

so this thread was about minecraft all along...
:roll:

jmgibson1981
Posts: 296
Joined: 2015-06-07 14:38
Has thanked: 11 times
Been thanked: 32 times

Re: [Solved] Disable logout on screensaver XFCE

#6 Post by jmgibson1981 »

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: 296
Joined: 2015-06-07 14:38
Has thanked: 11 times
Been thanked: 32 times

Re: [Solved] Disable logout on screensaver XFCE

#7 Post by jmgibson1981 »

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

Post Reply