Coder Social home page Coder Social logo

snapperl's Introduction

snapPERL v0.3.0

#####Automation script for Snapraid created in PERL

Snapraid wrapper script written in PERL. Enables automation using cron for your Array Syncs

Runs sync commands and verifys data using scrub command. Sends alerts when are issues found and aborts where needed. Plus much more see: snapPERL.conf.example

Website: snapPERL


Linux Compatible

Tested on Ubuntu 16.04LTS - Snapraid x64 v10.0

Windows Compatible

Requires a PERL distribution to be installed

Tested on Windows 10 - Snapraid x64 v10.0 and Latest ActivePerl

#####Script is expected to be run as root so it calls snapraid as root

Please Read!

  • CHANGELOG
  • INSTALL.md
  • INSTALL-WINDOWS.md
  • LICENSE
  • And the extensive comments for the options in: snapPERL.conf.example

#Created by Steve Miles (SmileyMan).

snapPERL Website

snapPERL Github

Inspired by this bash script: SnapRAID Sync Script -Zack Reed (http://zackreed.me)

Which in turn was a modified version of this bash script: SnapRAID Helper -Sidney Chong first created in 2011


#Work in Progress.

This is just a wrapper for snapraid.exe

It only ever calls snapraid (diff/status/sync/scrub/check/smart/down)

(only Snapraid manipulates the data)

####Script passes Perl::Critic - Severity: Stern


Important

This script does not write to or manipulate any Array Data


Command Line Options

Only for overrides - Set all permanent options in snapPERL.conf
snapPERL.pl [ -c  --conf CONFIG         { Full path to conf file        } ]
            [ -x  --custom-cmds FILE    { Full path to custom-cmds file } ]
            [ -m  --message-level 1-3   { Set message level             } ]
            [ -l  --log-level 1-5       { Set log level                 } ]
            [ --stdout    --nostdout    { Toggle log to stdout          } ]
            [ --check     --nocheck     { Toggle check option enable    } ]
            [ --scrub     --noscrub     { Toggle scrub option enable    } ]
            [ --email     --noemail     { Toggle email send             } ]
            [ --custom    --nocustom    { Toggle custom cmds            } ]
            [ --pushover  --nopushover  { Toggle Pushover send          } ]
            [ --smart     --nosmart     { Toggle smart logging          } ]
            [ --pool      --nopool      { Toggle snapraid pool          } ]
            [ --spindown  --nospindown  { Toggle spindown disks         } ]
            [ -h  --Help                { This Help                     } ]
            [ -v  --version             { Display Version               } ]

#Disclaimer

This SOFTWARE PRODUCT is provided by THE PROVIDER "as is" and "with all faults." THE PROVIDER makes no representations or warranties of any kind concerning the safety, suitability, lack of viruses, inaccuracies, typographical errors, or other harmful components of this SOFTWARE PRODUCT. There are inherent dangers in the use of any software, and you are solely responsible for determining whether this SOFTWARE PRODUCT is compatible with your equipment and other software installed on your equipment. You are also solely responsible for the protection of your equipment and backup of your data, and THE PROVIDER will not be liable for any damages you may suffer in connection with using, modifying, or distributing this SOFTWARE PRODUCT.

snapperl's People

Contributors

smileyman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar  avatar  avatar

Forkers

osjur

snapperl's Issues

Sync / Scrub $dataProcessed string error.

Getting some errors when the script is trying to output the amount of MB's processed after sync & scrub.
This is with SnapRAID v11.1 so I know this is " not supported" version as I guess you have only tested with v10.

Error strings:
Use of uninitialized value $dataProcessed in concatenation (.) or string at C:\s
napraid\snapPERL\snapPERL.pl line 467.

Use of uninitialized value $dataProcessed in concatenation (.) or string at C:\s
napraid\snapPERL\snapPERL.pl line 561.

It seems it doesn't initialize $dataProcessed variable so I tried to fix it myself but I have no idea where the variable is trying to find the data or if the variable is even correct. I disabled dataProcessed checking as a temporary workaround.

Email Send do not work

Hi,

found you script yesterday and I'm trying to get sending email over gmail working (even if I preffer push notifications).

I get this errors (Ubuntu Server 16.04, PERL v5.22.1, Snapraid v10.0):

Argument "Email::Send " isn't numeric in addition (+) at ./snapPERL.pl line 1430. Argument "Email::Simple::Creator " isn't numeric in addition (+) at ./snapPERL.pl line 1431. Can't locate object method "new" via package "Email::Send" (perhaps you forgot to load "Email::Send"?) at ./snapPERL.pl line 1484.

I've run install.sh so the modules should be installed.

everything else is working great

A couple of errors

Hello Steve,

I decided to give your script a run today on some test data. I hit a couple of snags I wanted to share with you. As soon as I ran the script, I had a couple of errors right away.

root@fileserver:~/scripts# perl snapPERL.pl
15:58:54 - Tue 3 May 2016 : Script Started
Use of uninitialized value $value in substitution (s///) at snapPERL.pl line 437.
Use of uninitialized value $value in pattern match (m//) at snapPERL.pl line 451.

Also, the script doesn't seem to handle some special characters (I'm assuming the exclamation points). Here's what I saw when it hit those files.

Error opening file '/mnt/data/disk06/anime/Durarara!!/Season 2/Durarara!! - S02E04 - 029 - When in Rome, Do as the Romans Do.mkv'. No such file or directory.
Error opening file '/mnt/data/disk06/anime/Durarara!!/Season 2/Durarara!! - S02E06 - 031 - A Crow in the Dark Night.mkv'. No such file or directory.
Error opening file '/mnt/data/disk06/anime/Durarara!!/Season 2/Durarara!! - S02E08 - 033 - The Ladies' Man Has Neither Money Nor Power.mkv'. No such file or directory.
Error opening file '/mnt/data/disk06/anime/Durarara!!/Season 2/Durarara!! - S02E07 - 032 - Moscow Does Not Believe in Tears.mkv'. No such file or directory.
Error opening file '/mnt/data/disk06/anime/Durarara!!/Season 2/Durarara!! - S02E11 - 036 - No Use Crying Over Spilt Milk.mkv'. No such file or directory.

The files listed above read and sync fine with snapraid diff/sync and are handled properly with the current BASH script. I look forward to seeing how this script turns out :) Thanks for your hard work!

Script indicates file error - status shows all OK

Somewhere between a bug report and an FYI - as it is hard to identify if there is a problem with your wrapper script or snapraid, however in the logs captured by your script (on multiple occasions now) ...

      1 file errors
       0 io errors
       0 data errors
Saving state to /var/snapraid.content...
Saving state to /mnt/data/disk1/snapraid.content...
Saving state to /mnt/data/disk2/snapraid.content...
  189231 files
       0 hardlinks
       1 symlinks
   76208 empty dirs
Verifying /var/snapraid.content...
Verifying /mnt/data/disk1/snapraid.content...
Verifying /mnt/data/disk2/snapraid.content... 

and an immediate snapraid status claims no issues:

No sync is in progress.
The 1% of the array is not scrubbed.
No file has a zero sub-second timestamp.
No rehash is in progress or needed.
No error detected.

I've been unable to reproduce this outside of using the script. Direct calls to snapraid complete without issue.

I know how little help this is, but am sharing what I discover as I am able.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.