Results 1 to 4 of 4

Thread: Linux script to force logoff users

  1. #1
    Join Date
    Jul 2009
    Posts
    92

    Linux script to force logoff users

    I want to create a Linux script to force logoff users after a fix time say 60 mins. How do i write a script in linux? I have been writing small batch programs in Windows. But i am totally new to linux. Any Help? Thanks in advance...

  2. #2
    Join Date
    Apr 2008
    Posts
    3,267

    Re: Linux script to force logoff users

    This may help you... A user will log out after one hour and will get a warning when last 5 minutes are remaining...

    Code:
    #!/bin/bash
    hour=1
    limit_time=`expr $hour \* 60 - 300`
    sleep $limit_time
    echo "5 Minutes More for automatic logoff"
    sleep 300
    logout
    exit 0

  3. #3
    Join Date
    Jul 2009
    Posts
    92

    Re: Linux script to force logoff users

    How to i make this text as a script file? How do i run it at startup with run level 5? I have no idea about this. In windows i just use to add this to startup in program files and it would do the trick. Thanks though.

  4. #4
    Join Date
    Jan 2009
    Posts
    1,738

    Re: Linux script to force logoff users

    Open any text editor and copy the above contents there. Now save this file without any extenstion or with .sh extension. Now save this file to /etc/init.d/ location. Then run :
    Code:
    cp logoff.sh /etc/init.d
    ln -s /etc/init.d/logoff.sh /etc/rc.d/rc5.d/S50logoff.sh
    ln -s /etc/init.d/logoff.sh /etc/rc.d/rc5.d/K50logoff.sh
    Now the logoff script is added to the start up...

Similar Threads

  1. Force User Logoff from windows server
    By Russyan in forum Active Directory
    Replies: 4
    Last Post: 10-01-2014, 10:39 AM
  2. Force logoff malfunctioning
    By giorgos in forum Operating Systems
    Replies: 4
    Last Post: 26-01-2010, 02:29 AM
  3. Delete files with logoff/on script
    By Pine Le in forum Windows Security
    Replies: 1
    Last Post: 03-06-2008, 11:19 PM
  4. Script to logoff XP systems after inactivity
    By aja44 in forum Windows Server Help
    Replies: 3
    Last Post: 03-03-2008, 03:11 PM
  5. logoff vbs script
    By Coreman in forum Windows Server Help
    Replies: 1
    Last Post: 28-04-2007, 06:02 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,715,620,926.93873 seconds with 17 queries