Skip to main content

Thread: Check for idle time


in effort keep external drive spinning down, i've created following script, , running root in cron:

code:
#!/bin/bash  # script keep external drive spinning down    diskmounted=$(mount | grep backup | wc -c)    if [ $diskmounted -gt 0 ]      touch /mnt/backup/.nosleep  fi
now, i'd make bit 'smarter'. don't nessecarily need drive spinning night. i'd check see how long computer has been idle before running script. if computer has been idle 30 minutes, i'd not 'touch' file on drive, , let spin down.

know can check idle time 'w' command, how parse idle time out of info?

example output 'w -s' command:
code:
derek@home-pc:~$ w -s   22:01:59  1:57,  2 users,  load average: 0.04, 0.12, 0.15  user     tty                    idle  derek    tty7     :0                1:57m gnome-session --session=ubuntu  derek    pts/0    :0                0.00s gnome-terminal

moved "programming talk."


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] Check for idle time


Ubuntu

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support