Go Back   TechArena Community > Software > Operating Systems
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , ,

Sponsored Links



Linux script to force logoff users

Operating Systems


Reply
 
Thread Tools Search this Thread
  #1  
Old 28-07-2009
Member
 
Join Date: Jul 2009
Posts: 88
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...
Reply With Quote
  #2  
Old 28-07-2009
MrChris-'s Avatar
Member
 
Join Date: Apr 2008
Posts: 3,237
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
Reply With Quote
  #3  
Old 28-07-2009
Member
 
Join Date: Jul 2009
Posts: 88
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.
Reply With Quote
  #4  
Old 29-07-2009
Member
 
Join Date: Jan 2009
Posts: 1,741
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...
Reply With Quote
Reply

  TechArena Community > Software > Operating Systems


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Linux script to force logoff users"
Thread Thread Starter Forum Replies Last Post
Force logoff malfunctioning giorgos Operating Systems 4 26-01-2010 02:29 AM
How to force a logoff in a logon script? John Windows Server Help 7 31-03-2008 02:54 AM
Force Auto Logoff and Logon ctulumba@gmail.com Windows Server Help 0 13-02-2008 09:49 PM
logoff vbs script Coreman Windows Server Help 1 28-04-2007 07:02 AM
Force User Logoff Rob Howard Active Directory 5 13-12-2004 07:53 PM


All times are GMT +5.5. The time now is 02:39 AM.