App-MBUtiny

 view release on metacpan or  search on metacpan

lib/App/MBUtiny/ConfigSkel.pm  view on Meta::CPAN

##############################################################################

<SendMail>
    To          to@example.com
    Cc          cc@example.com
    From        from@example.com

    # SMTP server
    SMTP        192.168.0.1
    # Authorization SMTP
    #SMTPuser   user
    #SMTPpass   password
</SendMail>

#
# Reporting flags
# Default: off
#
SendReport no
SendErrorReport no


##############################################################################
##
## Collector
##
##############################################################################

#
# Collector definitions (multiple blocks can be specified)
# Default: local collector, see "collector database interface"
#
#<Collector>
#    URL         https://user:password@collector.example.com/collector.cgi
#    Comment     Collector said blah-blah-blah # Optional for collector
#    #TimeOut    180
#</Collector>


##############################################################################
##
## Collector database interface
##
## See also collector.cgi.sample file
##
##############################################################################

#
# !!! WARNING !!!
#
# Before using the collector-server, please check your DataBase and create the mbutiny table
#

#-- For SQLite DB
#CREATE TABLE IF NOT EXISTS mbutiny (
#  `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
#  `type` INTEGER DEFAULT 0,         -- 0=internal/1=external
#  `time` NUMERIC DEFAULT 0,         -- unix time()
#  `name` CHAR(255) DEFAULT NULL,    -- name of mbutiny host
#  `addr` CHAR(45) DEFAULT NULL,     -- client ip addr
#  `status` INTEGER DEFAULT 0,       -- backup status
#  `file` CHAR(255) DEFAULT NULL,    -- backup filename
#  `size` INTEGER DEFAULT 0,         -- size of backup file
#  `md5` CHAR(32) DEFAULT NULL,      -- md5-checksum of backup file
#  `sha1` CHAR(40) DEFAULT NULL,     -- sha1-checksum of backup file
#  `error` TEXT DEFAULT NULL,        -- error message
#  `comment` TEXT DEFAULT NULL       -- comment
#);

#-- For MySQL DB
#CREATE TABLE `mbutiny` (
#  `id` int(11) NOT NULL auto_increment,
#  `type` int(2) default '0' COMMENT '0=internal/1=external',
#  `time` int(11) default '0' COMMENT 'unix time()',
#  `name` varchar(255) default NULL COMMENT 'name of mbutiny host',
#  `addr` varchar(45) default NULL COMMENT 'client ip addr',
#  `status` int(2) default '0' COMMENT 'backup status: 0=error/1=ok',
#  `file` varchar(255) default NULL COMMENT 'backup filename',
#  `size` int(11) default '0' COMMENT 'size of backup file',
#  `md5` varchar(32) default NULL COMMENT 'md5-checksum of backup file',
#  `sha1` varchar(40) default NULL COMMENT 'sha1-checksum of backup file',
#  `error` text default NULL COMMENT 'error message',
#  `comment` text default NULL COMMENT 'comment',
#  PRIMARY KEY  (`id`),
#  UNIQUE KEY `id` (`id`)
#) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

# Section for connection with Your database.
# Recommended for use follow databases: SQLite, MySQL, Oracle or PostgreSQL
# Default: SQLite

# SQLite example:
#<DBI>
#    DSN "dbi:SQLite:dbname=/var/lib/mbutiny/mbutiny.db"
#    Set RaiseError     0
#    Set PrintError     0
#    Set sqlite_unicode 1
#</DBI>

# MySQL example:
#<DBI>
#    DSN "DBI:mysql:database=mbutiny;host=mysql.example.com"
#    User username
#    Password password
#    Set RaiseError          0
#    Set PrintError          0
#    Set mysql_enable_utf8   1
#</DBI>

# Oracle Example
#<DBI>
#    DSN "dbi:Oracle:MYSID"
#    User username
#    Password password
#    Set RaiseError 0
#    Set PrintError 0
#</DBI>

Include hosts/*.conf

-----END FILE-----

-----BEGIN FILE-----
Name: foo.conf.sample
File: hosts/foo.conf.sample
Mode: 644

<Host foo>
    Enable          yes

    #
    # SendMail settings (optional, see general config file)
    #
    #<SendMail>
    #    To          to@example.com
    #    #Cc          cc@example.com
    #    #From        from@example.com
    #
    #    # SMTP server
    #    #SMTP        192.168.0.1
    #    # Authorization SMTP

lib/App/MBUtiny/ConfigSkel.pm  view on Meta::CPAN

    Trigger echo test > ./test/foo/test1.txt
    Trigger echo test > ./test/foo/test2.txt
    Trigger ls -la > ./test/foo/dir.lst
    Trigger test -d ./test/bar || mkdir ./test/bar
    Trigger echo test > ./test/bar/test1.txt
    Trigger echo test > ./test/bar/test2.txt
    Trigger echo test > ./test/bar/test3.txt
    Trigger ls -la > ./test/bar/dir.lst
    Trigger test -d ./test/bar/exc || mkdir ./test/bar/exc
    Trigger ls -la > ./test/bar/exc/dir.lst
    #Trigger mysqldump -f -h mysql.host.com -u user --port=3306 --password=password \
    #        --add-drop-table --default-character-set=utf8 \
    #        --databases databasename > ./test/databasename.sql

    #
    # Objects (source files and directories)
    #
    Object ./test/dir.lst
    Object ./test/foo

    #
    # Exlusive objects (multiple blocks can be specified)
    #
    <Exclude "my_exclude">
        # Source file or directory
        Object ./test/bar

        # Destination directory for processed files and directories (optional)
        #Target ./test/exc_target

        # Excluded object list (files and directories)
        Exclude test1.txt
        Exclude exc/dir.lst
    </Exclude>

    #
    # Collector definitions (multiple blocks can be specified)
    # Also see general config file
    #
    #<Collector>
    #    URL         https://user:password@collector.example.com/collector.cgi
    #    Comment     Collector said blah-blah-blah # Optional for collector
    #    #TimeOut    180
    #</Collector>

    #
    # Local storage (multiple blocks can be specified)
    #
    <Local>
        FixUP       off
        Localdir    ./test/mbutimy-local1
        Localdir    ./test/mbutimy-local2
        Comment     Local storage said blah-blah-blah # Optional for collector
    </Local>

    #
    # SFTP storage (multiple blocks can be specified)
    #
    #<SFTP>
    #    FixUP       on
    #    URL         sftp://user@example.com:22/path/to/backup/dir1
    #    URL         sftp://user@example.com:22/path/to/backup/dir2
    #    Set         timeout  180
    #    Set         key_path  /path/to/private/file.key
    #    Comment     SFTP storage said blah-blah-blah # Optional for collector
    #</SFTP>

    #
    # FTP storage (multiple blocks can be specified)
    #
    #<FTP>
    #    FixUP       on
    #    URL         ftp://user:password@example.com:21/path/to/backup/dir1
    #    URL         ftp://user:password@example.com:21/path/to/backup/dir2
    #    Set         Passive 1
    #    Set         Debug 1
    #    Comment     FTP storage said blah-blah-blah # Optional for collector
    #</FTP>

    #
    # HTTP storage (multiple blocks can be specified)
    # See eg/server.cgi example file on CPAN web site
    #
    #<HTTP>
    #    FixUP       on
    #    URL         https://user:password@example.com/mbuserver/path/to/backup/dir1
    #    URL         https://user:password@example.com/mbuserver/to/backup/dir2
    #    Set         User-Agent TestServer/1.00
    #    Set         X-Test Foo Bar Baz
    #    Comment     HTTP storage said blah-blah-blah # Optional for collector
    #</HTTP>

    #
    # Command storage (multiple blocks can be specified)
    #
    #<Command>
    #    FixUP       on
    #    test        "test -d ./mbucmd  && ls -1 ./mbucmd || mkdir ./mbucmd"
    #    put         "cp [FILE] ./mbucmd/[NAME]"
    #    get         "cp ./mbucmd/[NAME] [FILE]"
    #    del         "test -e ./mbucmd/[NAME] && unlink ./mbucmd/[NAME] || true"
    #    list        "ls -1 ./mbucmd"
    #    comment     Command storage said blah-blah-blah # Optional for collector
    #</Command>
</Host>

-----END FILE-----

-----BEGIN FILE-----
Name: collector.cgi.sample
File: collector.cgi.sample
Mode: 644

#!/usr/bin/perl -w
use strict;
use utf8;

use CGI;
use App::MBUtiny::Collector::Server "/mbutiny";

my $q = new CGI;
my $server = new App::MBUtiny::Collector::Server(
    project => "MBUtiny",
    ident   => "mbutiny",
    log     => "on",
    logfd   => fileno(STDERR),
);
$server->status or die($server->error);
print $server->call($q->request_method, $q->request_uri, $q) or die($server->error);

%ENDSIGN%
-----END FILE-----



( run in 0.534 second using v1.01-cache-2.11-cpan-39bf76dae61 )