Checkscript.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
K
 
(2 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
Script von [[NVRAM WakeUp]].
+
Skript von [[NVRAM WakeUp]].
  
{{Box Datei | $PATH/checkscript.sh |
+
{{Box Datei | [[Struktur|$PATH]]/checkscript.sh |
 
<pre>
 
<pre>
 
#!/bin/sh
 
#!/bin/sh
Zeile 10: Zeile 10:
 
test $5 -eq 0 -a $USERCOUNT -gt 0      && { echo "$USERCOUNT users are logged in."; exit; }
 
test $5 -eq 0 -a $USERCOUNT -gt 0      && { echo "$USERCOUNT users are logged in."; exit; }
  
# vdr2divx activ ist
+
# vdr2divx aktiv ist
 
#
 
#
 
pgrep 2divx >/dev/null 2>&1            && { echo divx-conversion is still running;  exit; }
 
pgrep 2divx >/dev/null 2>&1            && { echo divx-conversion is still running;  exit; }
  
# noad activ ist
+
# noad aktiv ist
 
#
 
#
 
pgrep noad >/dev/null 2>&1            && { echo "noad is still running";          exit; }
 
pgrep noad >/dev/null 2>&1            && { echo "noad is still running";          exit; }
  
# cutinplace activ ist
+
# cutinplace aktiv ist
 
#
 
#
 
pidof cutinplace >/dev/null 2>&1      && { echo "cutinplace is still running";    exit; }
 
pidof cutinplace >/dev/null 2>&1      && { echo "cutinplace is still running";    exit; }
  
# file existiert
+
# Datei existiert
 
#
 
#
 
test -a /some/file                    && { echo /some/file exists;                exit; }
 
test -a /some/file                    && { echo /some/file exists;                exit; }
  
# zugriffe per ssh offen sind
+
# Verbindungen per ssh offen sind
 
#
 
#
 
netstat -n|grep ^tcp|egrep -q ":22 "  && { echo "ssh";                            exit; }
 
netstat -n|grep ^tcp|egrep -q ":22 "  && { echo "ssh";                            exit; }
  
# Zugriffe auf samba shares offen sind
+
# Verbindungen auf samba Freigaben offen sind
 
#
 
#
 
netstat -n|grep ^tcp|egrep -q ":139 "  && { echo "smb";                            exit; }
 
netstat -n|grep ^tcp|egrep -q ":139 "  && { echo "smb";                            exit; }
  
# streamdev client activ ist
+
# streamdev client aktiv ist
 
#
 
#
 
netstat -n|grep ^tcp|egrep -q ":2004 " && { echo "streamdev";                      exit; }
 
netstat -n|grep ^tcp|egrep -q ":2004 " && { echo "streamdev";                      exit; }
  
# nfs shares offen sind
+
# PC erreichbar ist
#
+
showmount --no-headers|egrep -q ^[0-9] && { echo "nfs";                            exit; }
+
 
+
# pc erreichbar ist
+
 
#
 
#
 
ping -c 1 192.168.1.2 >/dev/null      && { echo "pc";                              exit; }
 
ping -c 1 192.168.1.2 >/dev/null      && { echo "pc";                              exit; }
Zeile 48: Zeile 44:
 
}}
 
}}
  
[[Kategorie:Scripts]]
+
[[Kategorie:Skripte]]

Aktuelle Version vom 4. November 2006, 16:09 Uhr

Skript von NVRAM WakeUp.

Datei
$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; }