Autoshutdown script 0.3.9.2 - No GUI yet

  • Obsolete!
    Please use the plugin from the 3rd party-repository
    --------------------


    Hi!


    For all who used my autoshutdown-script in OMV 0.4, here's a new version.
    I improved my autoshutdown-script with a few features:
    - UL-/DL-Rate check
    - CPU-Load-Check
    ^^ if these values are going over a userdefined value, the Server stays up
    - SMB check for connected clients via smbstatus
    - removed Sabnzbd-check - use ULDL-Rate instead


    Please test it and report back any Bugs with a debug-log. Without it I cannot fix a bug, thx.
    Make sure you read the included README ;)
    You can test the script with the "FAKE"-value in the autoshutdown.conf


    Heres the github-link (develop)
    https://github.com/OMV-Plugins/autoshutdown/tree/develop


    How to Install: (please follow every step exactly)
    With this, you'll get always the latest version

    Code
    cd ~
    wget https://github.com/OMV-Plugins/autoshutdown/archive/develop.zip
    unzip develop.zip
    cd autoshutdown-develop/src


    Read the readme with "cat README" and install the script with

    Code
    cp -R ./etc ./usr /
    cp /etc/autoshutdown.default /etc/autoshutdown.conf


    setup your /etc/autoshutdown.conf to fit your needs and save it


    Update the init-scripts

    Code
    insserv autoshutdown


    old (obsolete):

    Code
    update-rc.d  autoshutdown defaults


    Now you can run autoshutdown with

    Code
    service autoshutdown start


    make sure, autoshutdown is running with

    Code
    service autoshutdown status


    The Log is /var/log/autoshutdown.log


    Please report Bugs, if you find any
    And don't forget: RTFM ;)
    A GUI will follow, if the script is running as expected ;)


    Version 0.2 of the HowTo

  • Wenn wir schon bei offtopic sind: Me too.


    Gruß
    David


    PS: Mal schauen ob ich heute noch zum testen komme, ich hab ja noch das alte drauf unter 0.5.

    "Well... lately this forum has become support for everything except omv" [...] "And is like someone is banning Google from their browsers"


    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

    Upload Logfile via WebGUI/CLI
    #openmediavault on freenode IRC | German & English | GMT+1
    Absolutely no Support via PM!

  • Edit: Nevermind, it was a spelling error...


    Greetings
    David

    "Well... lately this forum has become support for everything except omv" [...] "And is like someone is banning Google from their browsers"


    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

    Upload Logfile via WebGUI/CLI
    #openmediavault on freenode IRC | German & English | GMT+1
    Absolutely no Support via PM!

  • Bugreport, Solo, find the logic error..............................




    Und ich wunder mich warum mein NAS die ganze zeit äuft....


    Gruß
    David

    "Well... lately this forum has become support for everything except omv" [...] "And is like someone is banning Google from their browsers"


    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

    Upload Logfile via WebGUI/CLI
    #openmediavault on freenode IRC | German & English | GMT+1
    Absolutely no Support via PM!

  • Ich versuchs mal:
    1. findet das script 2 IPs online, so dass sowieso nicht heruntergefahren wird.
    2. ist der "FAKE"-Mode ein, obwohl es in den Settings auskommentiert ist. Ich muss mal nachschauen, was beim config-check passiert.
    IIRC wird es auf true gesetzt, wenn es nicht definiert ist: Im Log sollte so was stehen: FAKE has to be true or false, setting it to "true"


    Edit: Hab grad in der autoshutdown.default den Fake-Mode auf false gesetzt. Bitte mit der neuesten Version nochmal versuchen. Alternativ kannst du auch die Zeile ändern:
    autoshutdown.default

    Code
    FAKE="false"


    ^^ ist jetzt von Haus aus so

  • Danke solo, der fail mit dem IP check ist mir dann auch noch aufgefallen.


    Achja, uphours wird auch per default auf 6-20 gestellt obwohl es standardmäßig auskommentiert ist.


    Arghs, wie bekomm ich das aus?


    Code
    Sep 10 15:47:03 chap logger: autoshutdown[18293]: WARN: ' Invalid parameter list format: UPHOURS [hour1..hour2]'
    Sep 10 15:47:03 chap logger: autoshutdown[18293]: WARN: ' You set it to '', which is not a correct syntax. Maybe it's empty?'
    Sep 10 15:47:03 chap logger: autoshutdown[18293]: WARN: ' Setting UPHOURS to 6..20'


    Ach und er braucht teilweise relativ lang um meine eigene IP zu detecten...



    Gruß
    David

    "Well... lately this forum has become support for everything except omv" [...] "And is like someone is banning Google from their browsers"


    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

    Upload Logfile via WebGUI/CLI
    #openmediavault on freenode IRC | German & English | GMT+1
    Absolutely no Support via PM!

  • Hast du nen HP N40L oder so was? Da wird das Netzwerk erst später gestartet.
    Mit dem UPHOURS muss ich nochmal schauen.


    Edit:
    ach das ist noch von der alten GUI, da wurden die werte per default eingetragen, auch wenn CHECKCLOCKACTIVE aus war. Brauchst dir keine Sorgen zu machen, ich schau mal nach, wenn die GUI dazu fertig ist.

  • You did the same mistake I made, you are checking for IPs with is superiour to the port check. So if IPs get detected autoshutdown won't shut your system down. Remove the IPs from the IP range and you will be fine.


    Greetings
    David

    "Well... lately this forum has become support for everything except omv" [...] "And is like someone is banning Google from their browsers"


    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

    Upload Logfile via WebGUI/CLI
    #openmediavault on freenode IRC | German & English | GMT+1
    Absolutely no Support via PM!

  • Mach bitte mal den "FAKE"-Mode an, stell SLEEP auf 10 und schick mir das komplette log nach ca. 5 min Laufzeit des Servers an walterheisenberg (ät) gmx.com
    Danke


    @ David: Er lässt aber nur auf IP 100,103,110 testen. Wenn für IP 101 gecheckt wird, isses definitiv ein Bug.
    An DEM Code hab ich aber nix geändert :o

  • Sorry, auf die config hab ich gar nicht geschaut sondern nur auf das Logfile...


    PS: Du bist ein freak.
    PPS: Zwei Folgen noch. *cry*


    Gruß
    David

    "Well... lately this forum has become support for everything except omv" [...] "And is like someone is banning Google from their browsers"


    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

    Upload Logfile via WebGUI/CLI
    #openmediavault on freenode IRC | German & English | GMT+1
    Absolutely no Support via PM!

  • die default kannst du lassen. Es wird nur die .conf eingelesen. Die init-scripts musst du nicht updaten. Wenn das script läuft, kannst du es mit

    Code
    kill $(ps -ef | grep autoshutdown.sh | grep -v grep | awk '{print $2}')


    killen und per /usr/local/bin/autoshutdown.sh neu starten. Wenn der FAKE-Mode ein ist, siehst du auch auf der Konsole den output.


    Zitat

    PS: Du bist ein freak.


    Das nehm ich mal als Kompliment :twisted: :lol:
    Hab halt noch nen Benutzernamen mit mail-adresse für github gebraucht und der war noch frei ...



    Edit:
    Ich kann an deinem Log nix ungewöhnliches erkennen. Außerdem ist der FAKE-Mode nicht an. Die IP 100 wird als aktiv gefunden, in der config ist angegeben, wenn die IP 100 aktiv ist -> nicht herunterfahren.

  • Eigentlich ja!
    Du hast nicht zufällig die autoshutdown.default geändert? Ich befürchte es fast ;)
    Was gibt

    Code
    cat /etc/autoshutdown.conf


    Die Config wird von autoshutdown geladen.

  • Poste mal bitte das exakte Ergebnis von
    cat /etc/autoshutdown.conf


    UND:
    Hast du den laufenden Prozess von autoshutdown.sh gekillt, wie ich es geschrieben hab? Wenn nicht, kann autoshutdown die neue config nicht einlesen, das passiert nur beim start. Der kill-befehl ist in diesem Post: http://forums.openmediavault.o…13&t=2570&start=10#p17975

  • Das script läuft bestimmt noch. Mir fällt jedenfalls nix anderes ein.
    Schau mal nach der Ausgabe von

    Code
    ps -ef | grep autoshutdown.sh


    Wenn es eine ausgabe so in der Art gibt, läuft ein script:

    Code
    root      2575  0.0  0.0  11660  1772 ?        S    17:17   0:02 /bin/bash /usr/local/bin/autoshutdown.sh


    Killen kannst du das script in dem Fall mit "kill 2575". Ersetze dabei die Nr. mit der Nr. nach "root". Dann Fake-Mode einschalten und das script mit /usr/local/bin/autoshutdown.sh starten. Sollte jetzt gehen!


    PS: Neustarten hilft evtl. auch

  • Du brauchst nur die erste Nr., also in deinem Fall "kill 32105"


    Das ganze hat mit der GUI nix zu tun, es muss auch so laufen.
    Was du noch versuchen kannst:
    1. script stoppen mit "kill ..."
    2. /etc/autoshutdown.conf umbenennen mit "mv /etc/autoshutdown.conf /etc/autoshutdown.conf.bak"
    3. script starten
    4. Log anschauen
    Dann sollte so was drin stehen: /etc/autoshutdown.conf not found
    Wie editierst du eigentlich deine config? mit nano?

  • Zitat von "chillerkiller"
    Code
    /autoshutdown-develop/src$ ps -ef | grep autoshutdown.sh
    root     32105 31832  0 20:50 ?        00:00:00 grep autoshutdown.sh


    Mit dem Befehl "kill 32105 31832" bekomme ich eine Fehlermeldung. Bin echt am verzweifeln.
    [...]


    Bitte genau lesen was du machen sollst. Du hast versucht dein grep (was du eben ausgeführt hast und somit zu einem Prozess wurde) zu schließen. Das kann aber nicht funktionieren da dass grep eh schon beendet ist. Dein autoshutdown lief also nicht mehr, wenn dies die einzige Ausgabe war.


    Gruß
    David

    "Well... lately this forum has become support for everything except omv" [...] "And is like someone is banning Google from their browsers"


    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

    Upload Logfile via WebGUI/CLI
    #openmediavault on freenode IRC | German & English | GMT+1
    Absolutely no Support via PM!

  • K, schön, dass es jetzt geht! Wieder mal ein typisches PEBKAC-Problem ;)
    Wenn ich schon

    Zitat

    cp /etc/autoshutdown.default /etc/autoshutdown.conf


    schreibe, dann bitte das nächste Mal auch so machen! Hätte uns ein bisschen Arbeit erspart

  • Code
    update-rc.d autoshutdown defaults


    Gruß
    David

    "Well... lately this forum has become support for everything except omv" [...] "And is like someone is banning Google from their browsers"


    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

    Upload Logfile via WebGUI/CLI
    #openmediavault on freenode IRC | German & English | GMT+1
    Absolutely no Support via PM!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!