Checkscript.sh
Aus VDR Wiki
Version vom 4. November 2006, 15:09 Uhr von Hulk (Diskussion | Beiträge)
Skript von NVRAM WakeUp.
$PATH/checkscript.sh
#!/bin/sh
# user eingeloggt sind
#
USERCOUNT=`who|wc -l`;
test $5 -eq 0 -a $USERCOUNT -gt 0 && { echo "$USERCOUNT users are logged in."; exit; }
# vdr2divx aktiv ist
#
pgrep 2divx >/dev/null 2>&1 && { echo divx-conversion is still running; exit; }
# noad aktiv ist
#
pgrep noad >/dev/null 2>&1 && { echo "noad is still running"; exit; }
# cutinplace aktiv ist
#
pidof cutinplace >/dev/null 2>&1 && { echo "cutinplace is still running"; exit; }
# Datei existiert
#
test -a /some/file && { echo /some/file exists; exit; }
# Verbindungen per ssh offen sind
#
netstat -n|grep ^tcp|egrep -q ":22 " && { echo "ssh"; exit; }
# Verbindungen auf samba Freigaben offen sind
#
netstat -n|grep ^tcp|egrep -q ":139 " && { echo "smb"; exit; }
# streamdev client aktiv ist
#
netstat -n|grep ^tcp|egrep -q ":2004 " && { echo "streamdev"; exit; }
# PC erreichbar ist
#
ping -c 1 192.168.1.2 >/dev/null && { echo "pc"; exit; }