NAS herunterfahren mit Ping- und Prozessprüfung

Status
Für weitere Antworten geschlossen.

AnnaM

Benutzer
Mitglied seit
01. Jul 2012
Beiträge
33
Punkte für Reaktionen
0
Punkte
6
Hallo Zusammen,

ich nutze zur Zeit das Script, damit sich die NAS herunterfährt, wenn kein Rechner mehr online ist.
Nun ist mir aufgefallen, dass sich das NAS auch herunter fährt, wenn ich mit der Erweiterung "Antivirus Essential" gerade einen Scan mache. Klar :)
Erklärung für das Verhalten: Ich habe eingestellt, dass jeden Sonntag das NAS um 06.25 hochfährt und um 06.30 der Scan angeht. Da zu dieser Zeit keine Clients hochgefahren und anpingbar sind, wird die NAS wieder heruntergefahren.
So solls aber nicht sein :-(
Kann man das vielleicht besser konfigurieren?
Oder noch besser: In den Einstellungen kann man angeben, dass nach 10 min die NAS schlafen gehen soll und nach weiteren (ich glaube) 1 Minute auch der Lüfter ausgeht.
Kann man dort nicht ansetzen und nach weiteren 10min die NAS herunterfahren? Das wäre doch viel effektiver, oder?

Ich hoffe ihr könnt mir weiterhelfen und/oder hab etwas schönes als Script :)

Lieben Gruß und vielen Dank im Voraus,
die Anna

EDIT: Auch habe ich diesen Thread hier durchgeschaut. Aber ich weiß nicht, wie ich es modifizieren kann.

P.S.: Ich mache kein Netzwerkbackup. Ich nutze "nur" File Station, Photo Station, DLNA/UPnP Medienserver, Antivirus Essential, Download Station und ganz normla die Freigabe für Windows
 

jahlives

Benutzer
Mitglied seit
19. Aug 2008
Beiträge
18.275
Punkte für Reaktionen
4
Punkte
0
auf der Shell müsste sich eigentlich recht zuverlässig ermitteln lassen ob noch ein Virenscan am Laufen ist oder ned. Letztlich müsste man "nur" gucken ob der Prozess clamav noch mit deutlicher Last läuft. Wirf mal einen Virenscan an und mach dann ein
Code:
ps | grep clamav
auf der Konsole und poste den Output mal hier rein. Vielleicht sehe ich darin gerade wie man diese Prüfung festmachen könnte.
 

AnnaM

Benutzer
Mitglied seit
01. Jul 2012
Beiträge
33
Punkte für Reaktionen
0
Punkte
6
Also es kommt:
Rich (BBCode):
 10080 root      2960 S    grep clamav

:eek:

Wenn mich nicht alles täuscht, ist aber ein anderer Prozess gerade am scannen:
Rich (BBCode):
 NAS> ps | grep synoavscan
 9782 root      123m R N  /var/packages/AntiVirus/target/bin/synoavscan --all
10485 root      2964 S    grep synoavscan
 

jahlives

Benutzer
Mitglied seit
19. Aug 2008
Beiträge
18.275
Punkte für Reaktionen
4
Punkte
0
heisst bei Syno also anders ;-)
Ist der Prozess weg wenn der Scan durch ist?
 

AnnaM

Benutzer
Mitglied seit
01. Jul 2012
Beiträge
33
Punkte für Reaktionen
0
Punkte
6
also ich sag einmal so.. das kommt, wenn kein VirenScan gestartet wurde:
Rich (BBCode):
ONAS> ps
  PID USER       VSZ STAT COMMAND
    1 root      2956 S    init
    2 root         0 SW   [kthreadd]
    3 root         0 SW   [ksoftirqd/0]
    4 root         0 SW   [events/0]
    5 root         0 SW   [khelper]
    8 root         0 SW   [async/mgr]
   88 root         0 SW   [sync_supers]
   90 root         0 SW   [bdi-default]
   91 root         0 SW   [kblockd/0]
   97 root         0 SW   [ata/0]
   98 root         0 SW   [ata_aux]
  113 root         0 SW   [rpciod/0]
  121 root         0 SW<  [kswapd0]
  122 root         0 SW   [nfsiod]
  275 root         0 SW   [scsi_eh_0]
  277 root         0 SW   [scsi_eh_1]
  301 root         0 SW   [mtdblockd]
  353 root         0 SW   [md0_raid1]
  359 root         0 SW   [md1_raid1]
  411 root         0 SW   [flush-1:0]
  412 root         0 SW   [flush-8:0]
  413 root         0 SW   [flush-8:16]
  414 root         0 SW   [flush-9:0]
  434 root         0 SW   [jbd2/md0-8]
  435 root         0 SW   [ext4-dio-unwrit]
 1525 root         0 SW   [kstriped]
 1711 root         0 SW   [khubd]
 1763 root         0 SW   [ksnapd]
 1833 root         0 SW   [crypto/0]
 1998 root         0 SW   [crypto]
 1999 root         0 SW   [crypto_ret]
 2101 root         0 SW   [ecryptfs-kthrea]
 2618 root      2956 S    /sbin/syslogd -S
 2623 root      2956 S    /sbin/klogd
 3046 root         0 SW   [md2_raid1]
 3137 root         0 SW   [kdmflush]
 3379 root      8268 S <  /usr/syno/bin/findhostd
 3483 root         0 SW   [jbd2/dm-0-8]
 3487 root         0 SW   [ext4-dio-unwrit]
 4247 root         0 SW   [flush-253:0]
 5135 admin    33756 S    /usr/syno/pgsql/bin/postgres -D /var/services/pgsql
 5138 admin    33756 S    postgres: writer process
 5139 admin    33756 S    postgres: wal writer process
 5158 root      8492 S    /usr/syno/bin/scemd
 5365 root         0 DW   [xhci_thread]
 5780 root         0 SW   [scsi_eh_2]
 5818 root         0 SW   [usb-storage]
 5902 root         0 SW   [usbhid_resumer]
 5991 root      8788 S    /usr/syno/sbin/hotplugd
 5995 root      2960 S    /sbin/getty 115200 console
 6007 root      5416 S    /usr/sbin/inetd
 6014 root      5416 S    /usr/sbin/crond
 6129 root      8996 S    /usr/syno/sbin/synologd
 6131 admin    34444 S    postgres: admin synolog [local] idle
 6165 root      7884 S    /usr/syno/sbin/cupsd -C /usr/local/cups/cupsd.conf
 6535 root     12732 S    /usr/syno/sbin/fileindexd
 6546 root     27136 S N  /usr/syno/sbin/synoindexd
 6552 root     26100 S N  /usr/syno/bin/synomkthumbd
 6634 root     17000 S    /usr/syno/sbin/nmbd -D
 6689 root     21128 S    /usr/syno/sbin/smbd -D
 6691 root     21128 S    /usr/syno/sbin/smbd -D
 7639 root         0 SW<  [kslowd000]
 7642 root         0 SW<  [kslowd001]
 7706 root     26096 S N  /usr/syno/sbin/synomkflvd
 7849 root      8964 S    /usr/syno/sbin/sshd
 7942 root     12620 S    /usr/syno/apache/bin/httpd -f /usr/syno/apache/conf/
 7952 root     12752 S    /usr/syno/apache/bin/httpd -f /usr/syno/apache/conf/
 7953 root     13156 S    /usr/syno/apache/bin/httpd -f /usr/syno/apache/conf/
 8193 root      2408 S    avahi-daemon: running [ONAS.local]
 8486 root     15440 S    /var/packages/DownloadStation/target/sbin/scheduler
 8492 admin    34848 S    postgres: admin download [local] idle
 9558 root     80332 S    /var/packages/MediaServer/target/sbin/dms
 9571 root      9440 S    /var/packages/MediaServer/target/sbin/lighttpd -f /v
 9652 root     63368 S    /usr/syno/apache/bin/httpd -DHAVE_PHP
 9654 nobody   63368 S    /usr/syno/apache/bin/httpd -DHAVE_PHP
 9655 nobody   63368 S    /usr/syno/apache/bin/httpd -DHAVE_PHP
 9656 nobody   63368 S    /usr/syno/apache/bin/httpd -DHAVE_PHP
 9659 root     12900 S    /usr/syno/apache/bin/httpd -f /usr/syno/apache/conf/
 9664 root     12752 S    /usr/syno/apache/bin/httpd -f /usr/syno/apache/conf/
 9665 root     12752 S    /usr/syno/apache/bin/httpd -f /usr/syno/apache/conf/
 9680 root     12036 S    sshd: root@pts/0
 9686 root      5420 S    -ash
 9695 root      5420 R    ps

und die Prozesse laufen, wenn der Virenscan gestartet wurde:
Rich (BBCode):
ONAS> ps
  PID USER       VSZ STAT COMMAND
    1 root      2956 S    init
    2 root         0 SW   [kthreadd]
    3 root         0 SW   [ksoftirqd/0]
    4 root         0 SW   [events/0]
    5 root         0 SW   [khelper]
    8 root         0 SW   [async/mgr]
   88 root         0 SW   [sync_supers]
   90 root         0 SW   [bdi-default]
   91 root         0 SW   [kblockd/0]
   97 root         0 SW   [ata/0]
   98 root         0 SW   [ata_aux]
  113 root         0 SW   [rpciod/0]
  121 root         0 DW<  [kswapd0]
  122 root         0 SW   [nfsiod]
  275 root         0 SW   [scsi_eh_0]
  277 root         0 SW   [scsi_eh_1]
  301 root         0 SW   [mtdblockd]
  353 root         0 SW   [md0_raid1]
  359 root         0 SW   [md1_raid1]
  434 root         0 SW   [jbd2/md0-8]
  435 root         0 SW   [ext4-dio-unwrit]
 1525 root         0 SW   [kstriped]
 1711 root         0 SW   [khubd]
 1763 root         0 SW   [ksnapd]
 1833 root         0 SW   [crypto/0]
 1998 root         0 SW   [crypto]
 1999 root         0 SW   [crypto_ret]
 2101 root         0 SW   [ecryptfs-kthrea]
 2618 root      2956 S    /sbin/syslogd -S
 2623 root      2956 S    /sbin/klogd
 3046 root         0 SW   [md2_raid1]
 3137 root         0 SW   [kdmflush]
 3379 root      8268 S <  /usr/syno/bin/findhostd
 3483 root         0 SW   [jbd2/dm-0-8]
 3487 root         0 SW   [ext4-dio-unwrit]
 4247 root         0 SW   [flush-253:0]
 5135 admin    33756 S    /usr/syno/pgsql/bin/postgres -D /var/services/pgsql
 5138 admin    33756 S    postgres: writer process
 5139 admin    33756 S    postgres: wal writer process
 5158 root      8492 S    /usr/syno/bin/scemd
 5365 root         0 DW   [xhci_thread]
 5780 root         0 SW   [scsi_eh_2]
 5818 root         0 SW   [usb-storage]
 5902 root         0 SW   [usbhid_resumer]
 5991 root      8788 S    /usr/syno/sbin/hotplugd
 5995 root      2960 S    /sbin/getty 115200 console
 6007 root      5416 S    /usr/sbin/inetd
 6014 root      5416 S    /usr/sbin/crond
 6129 root      8996 S    /usr/syno/sbin/synologd
 6131 admin    34444 S    postgres: admin synolog [local] idle
 6165 root      7884 S    /usr/syno/sbin/cupsd -C /usr/local/cups/cupsd.conf
 6535 root     12732 S    /usr/syno/sbin/fileindexd
 6546 root     27136 S N  /usr/syno/sbin/synoindexd
 6552 root     26100 S N  /usr/syno/bin/synomkthumbd
 6634 root     17000 S    /usr/syno/sbin/nmbd -D
 6689 root     21128 S    /usr/syno/sbin/smbd -D
 6691 root     21128 S    /usr/syno/sbin/smbd -D
 7639 root         0 SW<  [kslowd000]
 7642 root         0 SW<  [kslowd001]
 7706 root     26096 S N  /usr/syno/sbin/synomkflvd
 7849 root      8964 S    /usr/syno/sbin/sshd
 7942 root     12620 S    /usr/syno/apache/bin/httpd -f /usr/syno/apache/conf/
 7953 root     13156 S    /usr/syno/apache/bin/httpd -f /usr/syno/apache/conf/
 8193 root      2408 S    avahi-daemon: running [ONAS.local]
 8486 root     15440 S    /var/packages/DownloadStation/target/sbin/scheduler
 8492 admin    34848 S    postgres: admin download [local] idle
 9558 root     80332 S    /var/packages/MediaServer/target/sbin/dms
 9571 root      9440 S    /var/packages/MediaServer/target/sbin/lighttpd -f /v
 9652 root     63368 S    /usr/syno/apache/bin/httpd -DHAVE_PHP
 9654 nobody   63368 S    /usr/syno/apache/bin/httpd -DHAVE_PHP
 9655 nobody   63368 S    /usr/syno/apache/bin/httpd -DHAVE_PHP
 9656 nobody   63368 S    /usr/syno/apache/bin/httpd -DHAVE_PHP
 9659 root     12852 S    /usr/syno/apache/bin/httpd -f /usr/syno/apache/conf/
 9664 root     12844 S    /usr/syno/apache/bin/httpd -f /usr/syno/apache/conf/
 9665 root     12844 S    /usr/syno/apache/bin/httpd -f /usr/syno/apache/conf/
 9680 root     12036 S    sshd: root@pts/0
 9686 root      5420 S    -ash
 9723 root     12844 S    /usr/syno/apache/bin/httpd -f /usr/syno/apache/conf/
 9820 root     13528 S    /usr/syno/synoman/webman/3rdparty/AntiVirus/antiviru
 9822 root      131m R N  /var/packages/AntiVirus/target/bin/synoavscan --all
10634 root     12844 S    /usr/syno/apache/bin/httpd -f /usr/syno/apache/conf/
10886 root      5420 R    ps
 

AnnaM

Benutzer
Mitglied seit
01. Jul 2012
Beiträge
33
Punkte für Reaktionen
0
Punkte
6
Also ich habe mich nun in diese Thematik eingearbeitet und die Shell kennengelernt. Ich habe es nun gelöst und das NAS wird heruntergefahren, sobald alle Geräte (TV, PCs) im LAN aus sind und nicht mehr darauf zugreifen. Zusätzlich wird aber das NAS am Leben gehalten, wenn gerade ein Virenscan läuft. Danach wird wieder geprüft, ob Geräte nun verbunden sind. Ansonsten wird heruntergefahren.
Wer Interesse am Script hat, kann sich ja melden.
 

itari

Benutzer
Mitglied seit
15. Mai 2008
Beiträge
21.900
Punkte für Reaktionen
14
Punkte
0
Wer Interesse am Script hat, kann sich ja melden.

kopiere es doch einfach hier in diesen Thread mit rein ... dann kann man sich das einfach anschauen, wenn man es (vielleicht in ein paar Jahren) braucht

Itari
 

AnnaM

Benutzer
Mitglied seit
01. Jul 2012
Beiträge
33
Punkte für Reaktionen
0
Punkte
6
Ja, das mache ich, aber erst, wenn das Script ausgereift ist. Ich habe bis jetzt nur ein Problem. Ich habe das NAS unter dem Menüpunkt "Energie" so eingestellt, dass diese nach 10 Min in den Ruhezustand gehen soll.
Das Problem. Das Script wird dadurch angehalten und beendet. Was kann ich dagegen tun? Fährt das NAS wieder hoch, schaue ich mit "ps" und das Script ist beendet. Und was ist eigentlich der "erweiterte Ruhezustand"? Werden im Ruhezustand überhaupt noch Scripte ausgeführt?
 

itari

Benutzer
Mitglied seit
15. Mai 2008
Beiträge
21.900
Punkte für Reaktionen
14
Punkte
0
Ruhezustand = Disk-Spin-down

das bedeutet, alle Programme/Skripte laufen ungestört weiter ...

Itari
 

AnnaM

Benutzer
Mitglied seit
01. Jul 2012
Beiträge
33
Punkte für Reaktionen
0
Punkte
6
Aber dann hat es mit dem Log zu tun, was ich in temp schreibe. nach dem Ruhestand war das Script beendet.
 

itari

Benutzer
Mitglied seit
15. Mai 2008
Beiträge
21.900
Punkte für Reaktionen
14
Punkte
0
normalerweise bekommen die Programme und Skripte auf der DS nicht mit, dass sich Platten von selbst in den Ruhezustand bringen, weil dieses Disk-spin-down ja eine reine Plattencontrollergeschichte ist. Ich vermute, dass es etwas anderes ist ...

Itari
 

AnnaM

Benutzer
Mitglied seit
01. Jul 2012
Beiträge
33
Punkte für Reaktionen
0
Punkte
6
Hallo, wie kann ich schauen, ob jemand gerade die "Photo Station" oder "Audio Station" benutzt?
 

Puppetmaster

Benutzer
Sehr erfahren
Mitglied seit
03. Feb 2012
Beiträge
18.984
Punkte für Reaktionen
624
Punkte
484

AnnaM

Benutzer
Mitglied seit
01. Jul 2012
Beiträge
33
Punkte für Reaktionen
0
Punkte
6
Hallo, ich starte es, indem ich in /usr/syno/etc/rc.d/S12345auto.sh mein Script ausführe, welches ich unter /volume1/auto.sh gespeichert habe. Das Log wird in /tmp/auto.log gespeichert.

EDIT: Bis vor 2 Tagen hab ich noch nie "Shell" programmiert. Aber das Script läuft nach dem Log zu urteilen :)
 
Zuletzt bearbeitet:
Status
Für weitere Antworten geschlossen.
 

Kaffeautomat

Wenn du das Forum hilfreich findest oder uns unterstützen möchtest, dann gib uns doch einfach einen Kaffee aus.

Als Dankeschön schalten wir deinen Account werbefrei.

:coffee:

Hier gehts zum Kaffeeautomat