I’m trying to get a script working that will start a timer once a user logs in and will countdown 1 hour. At 5 minutes and 1 minute I would like to be able to pop up a window with a warning that the session will be ending soon and any unsaved work will be lost. At the end of the timer I would like the computer to reboot.
I already have a login script that is working very well to wipe and restore the profile to it’s original settings after each session. I just don’t know where to start or how to go about writing this script. I don’t think it will be that hard for some of you experts so I appreciate your patience and your help.
If you have any questions about my request I should be checking this thread fairly often.
It’s actually for a public library. Users need to be able to download files, take pictures off flash drives and cameras, print, compose word documents and such.
They are currently using Userful. It works but it uses Epiphany and support for saving and printing is spotty to say the best. Trying to replace it with SuSE. I looked at Ubuntu and Fedora as well but SuSE has the best tools for managing users. I just need to fix the auto-logoff issue and the system will be perfect for all intents and purposes.
I’m looking into those links and will let you know if they help. Thanks for your reply!
Sorry, using Gnome! That looks like it would accomplish what I need though. Anyone have any insight into a Gnome solution? I’m very new to scripting so basic help is appreciated. I can read scripts but usually have to research the commands. This script would go in /etc/gdm/PreSession/Default correct?
Thanks for your reply ken_yap but most of your terminology is above my head for now. Can you maybe bring it down a level or show me a basic example to try and tie in with what you’re saying?
When xdm gives a user a session, the script /etc/X11/xdm/Xstartup is run while still as root, before changing uid to that of the user. Symmetrically, when the user logs out, the script /etc/X11/xdm/Xreset is run as root. So you can edit these scripts, to schedule a timer, etc, or however you implement the forced shutdown.
Just be careful when editing those scripts since they affect all X logins. Make sure you are able to undo any changes from a CLI console. Maybe save a pristine copy of the scripts so that you can move them back in place if things go pear-shaped.
The amp (&) at the end of the line means execute this or in this case these statements but continue the script or routine you were in. The double amp makes sure the 2 statement get executed in sequence as one.
Ok so I’ve been trying several different things with several diffrent results. None of them were terrible encouraging.
I put “sudo /sbin/shutdown -r +5” into /etc/gdm/PreSession/Default. Now this works about 1 in 5 times, seems to usually work after a normal shutdown. But usually when I try and log in it throws an error about the session lasting less than 10 seconds and it will take me back to the login screen. Loging into failsafe mode lets me edit the script but to no avail.
I also tried putting this script into the /etc/X11/xdm/Xstartup. It didn’t do anything, no errors but no reboot either.
Help. If you guys need more specific data just ask and how to get it and I will try to give you what you need. I’m so close I can tell.
I’ll keep trying in the mean time. Thanks for the incredibly helpful posts.
I tried putting your example code into the Xstartup script with no visible results. No errors but no shutdown. This is similar to the last time I tried using the Xstartup approach to my solution. Is there any special way to edit the script or a certain syntax that is escaping me?