Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Novice needs help with logoff script

  1. #1

    Default Novice needs help with logoff script

    Hi there,
    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 cool, I read it on the INTERNET.

  2. #2

    Default Re: Novice needs help with logoff script

    Is this a bash script, csh script, python script, or what language is it in? It sounds like this is for an internet cafe.

  3. #3

  4. #4

    Default Re: Novice needs help with logoff script

    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!
    It's cool, I read it on the INTERNET.

  5. #5

    Default Re: Novice needs help with logoff script

    Yea, I looked at all of those links and they are all Kiosk systems. There is no infrastructure to implement a server side kiosk solution, especially to fix just this one small problem.

    Does anyone know of a script that will reboot a computer a set time after the user logs in? Or a client side program that will accomplish this task?
    It's cool, I read it on the INTERNET.

  6. #6
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Novice needs help with logoff script

    How about something like this, but you'll probably have to write it yourself.

    Hook into the xdm login scripts while still root (Xstartup) and not yet switched to the user identity. Schedule two at jobs, one to issue the warning and another to reboot the machine.

    You'll also have to cancel the jobs if the user has logged out before time is up, using the Xreset hook.

    man xdm explains the order of the script execution.

  7. #7
    Join Date
    Jul 2008
    Location
    Netherlands
    Posts
    26

    Default Re: Novice needs help with logoff script

    If you have kde4 installed, You can put a script in the .kde4/Autostart/ folder of every user that has to logout. Lookup the skeleton to make this default

    The script would be something like:

    Code:
    kdialog --title Greeting --msgbox 'Reboot in 60 minutes'
    sleep 3300
    kdialog --title Warning --msgbox 'Reboot in 5 minutes' 
    sleep 300
    init 6
    make sure kdialog is installed. Try on you own risk :-)
    You'll never get a second change to eat your first herring

  8. #8

    Default Re: Novice needs help with logoff script

    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?
    It's cool, I read it on the INTERNET.

  9. #9

    Default Re: Novice needs help with logoff script

    Ok so I had some success and some failure and I hope you guys can get me back on track. I added this code

    sleep 60
    sudo /sbin/reboot

    to /etc/gdm/PreSession/Default

    and it worked! It automatically rebooted the system after 60 seconds!

    One problem. It just sat at a green screen without anything loading. I couldn't get the script to not run in any failsafe mode or terminal login so I just reinstalled.

    What did I do wrong? Is there a different place I can put this script that will keep it from making the system hang?

    P.S. I know 60 is only a minute but this was just for testing purposes.
    It's cool, I read it on the INTERNET.

  10. #10
    Join Date
    Jul 2008
    Location
    Netherlands
    Posts
    26

    Default Re: Novice needs help with logoff script

    try
    Code:
    sleep 60 && sudo reboot &
    You'll never get a second change to eat your first herring

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •