Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Testing for whether or not anybody is logged in
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
MasquedAvenger
Guru
Guru


Joined: 21 Aug 2003
Posts: 559
Location: Southern California

PostPosted: Thu Aug 09, 2007 7:04 pm    Post subject: Testing for whether or not anybody is logged in Reply with quote

Hey everyone. I have a setup in which my server wakes my desktop up via wake-on-LAN, afterwhich my desktop rsyncs with my server's backups to ensure that I have them saved to more than one machine. I want to have my desktop shutdown after it's finished with the rsync, but the problem is that you never know if anybody is going to be logged onto the system at the time that it shuts down.

I could very likely be up at 3AM doing stuff on the computer when the cron job completes, afterwhich the machine would shutdown on me in the middle of my work. What I want to do is only shutdown the machine when it's finished if there's nobody logged on. The problem is that I don't know how to test for this condition, much less how to test for this condition in a script. I'm sure there's a standard utility that will give me this information, but I'm not sure what it is.

Any help would be greatly appreciated :) Thanks in advance.

James
_________________
"There are no uninteresting things; only uninterested people." --G.K. Chesterton
Back to top
View user's profile Send private message
Earthwings
Bodhisattva
Bodhisattva


Joined: 14 Apr 2003
Posts: 7753
Location: Germany

PostPosted: Thu Aug 09, 2007 7:09 pm    Post subject: Reply with quote

Code:
who -u | wc -l

hth
_________________
KDE
Back to top
View user's profile Send private message
MasquedAvenger
Guru
Guru


Joined: 21 Aug 2003
Posts: 559
Location: Southern California

PostPosted: Thu Aug 09, 2007 8:01 pm    Post subject: Reply with quote

That's perfect. Thanks :)

James
_________________
"There are no uninteresting things; only uninterested people." --G.K. Chesterton
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum