LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   catch hibernate, suspend and login, logout events (https://www.linuxquestions.org/questions/programming-9/catch-hibernate-suspend-and-login-logout-events-800562/)

naveenisback 04-07-2010 06:57 AM

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

TB0ne 04-07-2010 09:18 AM

Quote:

Originally Posted by naveenisback (Post 3927327)
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.

pixellany 04-07-2010 02:14 PM

The other thread has been closed.

naveen*;
Please explain why you are posting the identical message as another member.

blahblah 04-08-2010 02:20 AM

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..

TB0ne 04-08-2010 12:30 PM

Quote:

Originally Posted by blahblah (Post 3928278)
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.


All times are GMT -5. The time now is 12:40 AM.