我制作了一个脚本来监控工作人员实际使用PC的时间,让它在2分钟不活动后锁定屏幕。
#!/usr/bin/env bash
day=$(date +"%d-%m-%Y")
dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver',member='ActiveChanged'" | while read line ; do
if [ x"$(echo "$line" | grep 'boolean true')" != x ] ;
then
echo "lock#$(date +%R)" >> /home/user/.worklog/work.$day
fi
if [ x"$(echo "$line" | grep 'boolean false')" != x ] ;
then
echo "unlock#$(date +%R)" >> /home/user/.worklog/work.$day
fi
done
我的问题是:
当我监控Ubuntu 12.04时,输出为:
lock#10:56
unlock#10:56
lock#11:00
unlock#11:32
lock#11:44
unlock#13:01
lock#13:10
但是,当我监控Ubuntu 12.10时,输出是:
unlock#08:24
lock#08:45
unlock#08:45
lock#08:55
lock#09:13
unlock#09:13
unlock#09:13
lock#10:38
lock#10:39
unlock#10:39
unlock#10:39
lock#10:52
unlock#10:52
lock#11:03
任何人都知道如何修复?