Autoshutdown-Plugin

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Autoshutdown-Plugin

      Hi!

      I ported a autoshutdown-script (thx chirikai for this) from FreeNAS to Debian/Ubuntu and now made some improvements. Features:
      • Check, if PC is online (via IP)
      • Check, if processes are running (smbd, nfsd, transmission-daemon...)
      • Check, if there are connections on Ports (SSH, FTP, Bittorrent ...
      • ^^^ if not, shutdwon, after a period of time
      • Read actual IP(s) from ifconfig (eth0, eth1, bond0)
      • define a timerange, in which OMV should stay up (whether other PCs are online or not)
      • and many others
      • Fake-Mode to test your settings. With this, OMV does not shutdown, but displays all what it does in the log
      • the script waits 5 min after start (not in Fake-Mode)

      Testers welcome ;) I tried to keep the configuration very small and simple.

      Thx to :arrow: marcelbeck for the GUI, all testers and bug-reporters.

      Please report any issue related to the:
      WebUI here: github.com/OMV-Plugins/openmediavault-autoshutdown/
      installation process and the script itself here: github.com/OMV-Plugins/autoshutdown/

      Installation:
      OMV:
      Install the Autoshutdown-Plugin from the stable repository: packages.omv-plugins.org/ in OMV

      Debian/Ubuntu:
      Use the deb from here. Make sure you install always the latest version.

      For Expert-Settings in the config, please have a look at the included autoshutdown.default (/etc/autoshutdown.default) and the README

      Thx
      "Glowing days. Don't cry because they are over. Smile because they happened." - Confucius

      Server: 1x 32GB SSD (system) - 5x 2TB Data - 1x 2TB Snapraid-Parity - latest OMV 1.x
      No Support through PM
      Tutorials --- Howto install OMV-Extras --- Upgrade/Update-Problems --- If autoshutdown doesn' -work
    • Re: Autoshutdown-Plugin

      Hello all.
      I’m having some setup errors that I cannot fix myself and could use some advice please.
      In the log file I’m seeing :

      Brainfuck Source Code

      1. openmediavault /etc/init.d/autoshutdown: Autoshutdown-script starting ...
      2. openmediavault logger: autoshutdown[27841]: INFO: ' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
      3. openmediavault logger: autoshutdown[27841]: INFO: ' X Version: 0.3.3.3'
      4. openmediavault logger: autoshutdown[27841]: INFO: ' Initialize logging to local6'
      5. openmediavault logger: autoshutdown[27841]: INFO: ' /etc/shutdown.conf loaded'
      6. openmediavault logger: autoshutdown[27841]: INFO: ' ------------------------------------------------------'
      7. openmediavault logger: autoshutdown[27841]: INFO: ' Checking config'
      8. openmediavault logger: autoshutdown[27841]: INFO: ' NETSTATWORD not set in the config. The check for connections, like SSH (Port 22) will not work on the CLI until you set NETSTATWORD'
      9. openmediavault logger: autoshutdown[27841]: INFO: ' If you run this sript at systemstart with init.d it will work as expected'
      10. openmediavault logger: autoshutdown[27841]: INFO: ' Read the README for further Infos'
      11. openmediavault logger: autoshutdown[27841]: WARN: ' Invalid parameter list format: TEMPPROCNAMES [tproc1,tproc2,tproc3,...]'
      12. openmediavault logger: autoshutdown[27841]: WARN: ' You set it to 'in.tftpd#015', which is not a correct syntax.'
      13. openmediavault logger: autoshutdown[27841]: WARN: ' exiting ...'
      Display All



      And I Guess this is telling me that I have “'in.tftpd#015'” listed as a configuration option?

      However in the web interface it is set as TEMPPROCNAMES="in.tftpd"in extra options.

      I can leave the extra option TEMPPROCNAMES blank and still would get the warning:

      Source Code

      1. openmediavault logger: autoshutdown[27841]: WARN: ' You set it to '#015', which is not a correct syntax.'


      I have looked at the config files in etc/ autoshutdown.* and I do not see the “'#015'” anywhere. So I do not know where its finding that '#015' in the warning.
      I’m doing something wrong?

      Thanks,
      Ack.
    • Re: Autoshutdown-Plugin

      Please open a CLI (command line) and post the output of

      Source Code

      1. cat -v /etc/autoshutdown.conf

      "-v" prints the non-printables characters, maybe we find something then ...
      More Info here
      "Glowing days. Don't cry because they are over. Smile because they happened." - Confucius

      Server: 1x 32GB SSD (system) - 5x 2TB Data - 1x 2TB Snapraid-Parity - latest OMV 1.x
      No Support through PM
      Tutorials --- Howto install OMV-Extras --- Upgrade/Update-Problems --- If autoshutdown doesn' -work
    • Re: Autoshutdown-Plugin

      Much thanks,

      Shell-Script

      1. #!/bin/bash
      2. # This configuration file is auto-generated.
      3. # WARNING: Do not edit this file, your changes will be lost.
      4. FLAG="6"
      5. SLEEP="180"
      6. RANGE="2..254"
      7. CHECKCLOCKACTIVE="false"
      8. UPHOURS="6..20"
      9. NSOCKETNUMBERS=""
      10. SYSLOG="true"
      11. VERBOSE="true"
      12. FAKE="false"
      13. NW_INTENSESEARCH=
      14. TEMPPROCNAMES="in.tftpd"^M
      15. LOADPROCNAMES="smbd,nfsd,transmission-daemon,mt-daapd"
      Display All


      thats the file. I see the errant "^M" .

      Logic tell me to edit it out. However the file clearly reads "# WARNING: Do not edit this file, your changes will be lost."

      Advise please.

      Thanks.
      Ack.
    • Greenkeeper wrote:

      Because the link in the first thread is not working anymore? Or what do I need to use this script on a debian 9.3 server (no OMV).
      The script is in the plugin package. It is tightly integrated with OMV and cannot be used without omv
      omv 4.1.6 arrakis | 64 bit | 4.16 backports kernel | omvextrasorg 4.1.7
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please read this before posting a question.
      Please don't PM for support... Too many PMs!
    • Hallo,

      Autoshutdown Version 4.0.3

      es schein aktuell in OMV4 ein Problem mit autoshutdown, bei Überwachung des CPU Loads

      Shell-Script: /usr/sbin/autoshutdown.sh

      1. CURRENT_LOADAVERAGE_TEMP1="$(top -b -n 1 | grep 'load average')"
      2. # old: not working, if uptime is more than 1 day
      3. #CURRENT_LOADAVERAGE_TEMP2="$(echo $CURRENT_LOADAVERAGE_TEMP1 | awk '{print $11}' | sed 's/,//g')"
      4. CURRENT_LOADAVERAGE_TEMP2="$(echo $CURRENT_LOADAVERAGE_TEMP1 | sed 's/.*load average: //g' |awk '{print $1}' | sed 's/,//g' | sed 's/.//g;s/\.//g')"
      5. if [ "$CURRENT_LOADAVERAGE_TEMP2" = "0.00" ]; then
      6. CURRENT_LOADAVERAGE=0
      7. else
      8. CURRENT_LOADAVERAGE=$(echo $CURRENT_LOADAVERAGE_TEMP2 | sed 's/[,.]//g' | sed 's/^0*//g')
      9. fi
      10. if $DEBUG; then
      11. _log "DEBUG: -------------------------------------------"
      12. _log "DEBUG: _check_loadaverage(): Output of: 'top -b -n 1 | grep 'load average'"
      13. _log "DEBUG: _check_loadaverage(): '$CURRENT_LOADAVERAGE_TEMP1'"
      14. _log "DEBUG: _check_loadaverage(): CURRENT_LOADAVERAGE_TEMP2: $CURRENT_LOADAVERAGE_TEMP2"
      15. _log "DEBUG: _check_loadaverage(): CURRENT_LOADAVERAGE: $CURRENT_LOADAVERAGE"
      16. fi
      17. if [ $CURRENT_LOADAVERAGE -gt $LOADAVERAGE ]; then
      18. _log "INFO: Loadaverage ($CURRENT_LOADAVERAGE_TEMP2 -> $CURRENT_LOADAVERAGE) is higher than target ($LOADAVERAGE) - no shutdown"
      19. let RVALUE++
      20. else
      21. _log "INFO: Loadaverage ($CURRENT_LOADAVERAGE_TEMP2 -> $CURRENT_LOADAVERAGE) is lower than target ($LOADAVERAGE)"
      22. fi
      23. if $DEBUG ; then _log "DEBUG: _check_loadaverage(): RVALUE: $RVALUE" ; fi
      24. return ${RVALUE}
      Display All

      Wenn ich die Zeilen 432 und 435 in der Console ausführe, ist das Ergebnis in CURRENT_LOADAVERAGE_TEMP2 leer.
      Führe ich aber Zeile 434 zeigt sie ein Ergebnis.
      Das führt dazu, dass Zeile 451 Fehler ausgibt im syslog:

      /usr/sbin/autoshutdown.sh: Zeile 451: [: -gt: Einstelliger (unärer) Operator erwartet.

      Und der REchner nicht herunterfährt.

      Jetzt bin ich nicht der sed und awk kenner, um das Lösen zu können.
      Aber ich denke ihr bekommt es hin :D

      Achso, hier noch die Ausgabe von CURRENT_LOADAVERAGE_TEMP1, wo es nich funktioniert

      top - 06:15:58 up 6:47, 2 users, load average: 0,12, 0,14, 0,13

      Gruß
      Sven