Blondie wrote:
> Hello!
>
> Thank you for this great plugin!
>
> i would add a custom idle check command. If i logged in via ssh the
> server should not go down.
> If i execute
> who | sudo wc -l
> at the shell, the command returns how many users are logged in.
>
> But if i use that as custom idle check command, it returns:
> Plugins::SrvrPowerCtrl::Util::SystemExecCmd (862) Command: "sudo who |
> wc -l" returned 256
>
> I have also tried to write a script:
> if who | wc -l > 0
> then
> echo 1
> else
> echo 0
> fi
>
> but that will also not working.
>
> What should i enter or do here?
>
> regards
> Blondie
Blondie: Your idea was a good one and I'm using it all the time on my
own system now. I've extended your custom idle check script to check
for samba file locks too. This is still a little experimental. I'll
use this for a few days and see how it works.
spc-checkidle.sh:
Code:
--------------------
#!/bin/sh
# SrvrPowerCtrl custom idle check script.
#
# This returns the number of user log-ins or the number
# of active samba locks and can be used to prevent
# SrvrPowerCtrl on-idle actions.
#
# Configure SrvrPowerCtrl's "Custom Idle check command" to
# call this script.
# Check for login sessions
USERCOUNT=`who | wc -l`
USERCOUNT=`expr $USERCOUNT \* 1`
if [ $USERCOUNT -gt 0 ]; then
echo "Usercount: ${USERCOUNT}"
exit $USERCOUNT
fi
# Check for samba locks
SAMBALOCKS=`smbstatus -L | grep 'EXCLUSIVE' | wc -l`
SAMBALOCKS=`expr $SAMBALOCKS \* 1`
if [ $SAMBALOCKS -gt 0 ]; then
echo "Samba locks: ${SAMBALOCKS}"
exit $SAMBALOCKS
fi
exit 0
--------------------
------------------------------------------------------------------------
gharris999's Profile: http://forums.slimdevices.com/member.php?userid=115
View this thread: http://forums.slimdevices.com/showthread.php?t=48521
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins