Prevent suspend from another xbmc machine
#1
I have my main htpc set to suspend after 30 mins of inactivity.

Is there a way to stop it suspending when another xbmc machine is on? Is there someway to reset the idle timer remotely?
Reply
#2
I use a xcript to check if there is any net activity on my server
[code]
!/bin/bash

#test connexion SSH HTTPS et NFS
connexionSSH=$((netstat -n | grep ESTA) | grep -c 10000)
connexionhttps=$((netstat | grep ESTA)| grep -c https)
connexionSMB=$((netstat | grep ESTA) | grep -c microsoft)
connexionTVHeadend=$((netstat -n | grep ESTA) | grep -c 9982)
connexionNFS=$((netstat | grep ESTA) | grep -c nfs)
connexionUsenet=$((netstat | grep ESTA) | grep -c newszilla)
echo shh
echo $connexionSSH
echo subsonic
echo $connexionhttps
echo nfs
echo $connexionNFS
echo tv
echo $connexionTVHeadend
echo smb
echo $connexionSMB
echo usenet
echo $connexionUsenet
if [ $connexionSSH -eq 0 ] && [ $connexionNFS -eq 0 ] && [ $connexionhttps -eq 0 ] && [ $connexionTVHeadend -eq 0 ] && [ $connexionSMB -eq 0 ] && [ $connexionUsenet -eq 0 ]
then
pm-suspend
fi
exit 0

{/code]
Reply
#3
Thank you, I have managed to cobble this together

Code:
#!/bin/bash
sleep 30
if [ `netstat -t | grep -c ":9982"` -ge 3 ]
then
      exit 1
elif [ `netstat -t | grep -c "192.168.0.:microsoft-ds ESTABLISHED"` -ne 0 ]
then
      exit 1
else
      pm-suspend
fi

Which seems to work only problem is that it does not take account of an active recording.

The 9982 3 times is to take account of the fact xbmc runs on the same machine and is always connected on that port. I may be able to take account of recordings if I remove the directory off the local machine put it on a windows share and count for more 192.168.0.:microsoft-ds ESTABLISHED.
Reply
#4
Code:
#!/bin/bash
cd ~billy/.hts/tvheadend/dvr/log
current_date=`date +%s`

for i in $( ls ); do
tmp_start=`cat $i | grep '"start":' | cut -f 2 -d " " | cut -f 1 -d ","`
tmp_stop=`cat $i | grep '"stop":' | cut -f 2 -d " " | cut -f 1 -d ","`

# check for any current recording
if [ $((tmp_stop)) -gt $((current_date)) -a $((tmp_start)) -lt $((current_date)) ]; then
exit 1
fi
done
if [ `netstat -t | grep -c ":9982"` -ge 3 ]
then
      exit 1
elif [ `netstat -t | grep -c "192.168.0.:microsoft-ds ESTABLISHED"` -ne 0 ]; then
      exit 1
else
      sudo pm-suspend
fi

This does it.
Reply

Logout Mark Read Team Forum Stats Members Help
Prevent suspend from another xbmc machine0