LinuxQuestions.org
Visit Jeremy's Blog.
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 04-07-2010, 06:57 AM   #1
naveenisback
Member
 
Registered: Jun 2009
Posts: 80
Blog Entries: 1

Rep: Reputation: 16
catch hibernate, suspend and login, logout events


Hi

language: c programming
os : ubuntu 9.10

I am doing a program in which I want to catch events when system shutdowns, hibernated, suspended, user logged out and when user logged in(gnome and sh in both).

I successfully catched shutdown event by placing a sript in runlevel 0 and 6.. But unable to catch hibernate, suspend , login and log out events.
I know we can use lastlog to get login records.. but It gives database of login only..

so please tel me how can i catch these signals.. suggest a c program or shell script to do this..

Thank You in advance
 
Old 04-07-2010, 09:18 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,553

Rep: Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946
Quote:
Originally Posted by naveenisback View Post
Hi

language: c programming
os : ubuntu 9.10

I am doing a program in which I want to catch events when system shutdowns, hibernated, suspended, user logged out and when user logged in(gnome and sh in both).

I successfully catched shutdown event by placing a sript in runlevel 0 and 6.. But unable to catch hibernate, suspend , login and log out events.
I know we can use lastlog to get login records.. but It gives database of login only..

so please tel me how can i catch these signals.. suggest a c program or shell script to do this..

Thank You in advance
Huh...there's another user on here asking the same thing:
http://www.linuxquestions.org/questi...events-800327/

Perhaps you and he could get together, and work with him to write this code.
 
1 members found this post helpful.
Old 04-07-2010, 02:14 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
The other thread has been closed.

naveen*;
Please explain why you are posting the identical message as another member.
 
1 members found this post helpful.
Old 04-08-2010, 02:20 AM   #4
blahblah
LQ Newbie
 
Registered: Nov 2009
Posts: 6

Rep: Reputation: 0
Hi..

First Sorry for posting the same thread here..

The reason is: that naveen is my friend and he is working along with me. Since I didnot get any reply for my question, I asked him to post the same in his blog..

Ok.. sorry again..
Please send the answers..

Last edited by blahblah; 04-08-2010 at 02:40 AM.
 
Old 04-08-2010, 12:30 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,553

Rep: Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946
Quote:
Originally Posted by blahblah View Post
Hi..

First Sorry for posting the same thread here..

The reason is: that naveen is my friend and he is working along with me. Since I didnot get any reply for my question, I asked him to post the same in his blog..

Ok.. sorry again..
Please send the answers..
Sorry, that's a lie.

Your 'friend' Naveen posted at 6:57, and your post was at 7:22. So you asked your 'friend' to post the same question, BEFORE you did?? And even if it was the other way around, too bad...you don't get an answer within 30 minutes, so you post again??

You and your 'friend', should Google for "linux hibernate event". Things come up that you can look at, one of them is even a shell script.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
catch login, hibernate, suspend events.. blahblah Programming 2 04-07-2010 02:13 PM
my dirty hack for suspend/hibernate at kdm login screen Old_Fogie Slackware 5 01-07-2010 09:14 AM
cannot login after hibernate/suspend homyangcha Linux - Newbie 2 01-21-2009 12:17 AM
how to catch events nick021 Linux - Software 2 04-07-2006 07:24 PM
how to catch hotplug events ? ritchy Linux - General 2 04-06-2006 02:02 PM

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

All times are GMT -5. The time now is 06:10 PM.

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