LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-26-2008, 10:38 PM   #1
noir911
Member
 
Registered: Apr 2004
Posts: 682

Rep: Reputation: Disabled
[C] automatically logout users


I am learning C and want to write a program that would kick out users if they are idle for more than "x" minutes.

Could anyone tell me what functions do I need to write this program?
 
Old 06-26-2008, 11:39 PM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
pseudocode:

Code:
main () {
   set timer or sleep n
   if timer expired
      kill process id of user's shell
}
The system or library calls you'll want to expore: kill(2), sleep(3). There are others for more control.
 
Old 06-27-2008, 01:47 AM   #3
Swagata Paul
Member
 
Registered: Jun 2008
Location: Kolkata, India
Posts: 57

Rep: Reputation: 15
Hi noir911,
Did u implemented the C code from the pseudocode given by Mr. C. ?

Or I have to write for u?
 
Old 06-27-2008, 01:53 AM   #4
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
How can a student learn if you give the answer? The learning comes from working out the details, exploring, and discovery. Don't take away that opportunity.
 
Old 06-29-2008, 01:20 AM   #5
iwasapenguin
Member
 
Registered: Jul 2007
Posts: 110

Rep: Reputation: 15
Embed shell script into the code.
That's what system("command") is there for.
Now don't ask for any more detail than that!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Logout Users carlosinfl Linux - General 5 05-10-2007 12:57 PM
Stop Gnome From Automatically Logout fueldistributa Linux - Newbie 4 05-30-2006 08:29 AM
logout out automatically after a couples of seconds yenonn Linux - Security 6 05-09-2005 03:43 AM
How do I automatically logout after a period of inactivity? AshleyK Linux - Security 4 12-31-2004 10:47 PM
Where to run scripts automatically on login/logout hilltop*Tech Linux - General 2 02-06-2004 10:59 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration