Skip to content

Commit

Permalink
rotatebackups: wrap Tcl code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto Reale committed Nov 11, 2016
1 parent 5624dee commit 053e17a
Showing 1 changed file with 66 additions and 13 deletions.
79 changes: 66 additions & 13 deletions examples/rotatebackups/bin/rotatebackups
Original file line number Diff line number Diff line change
@@ -1,14 +1,62 @@
#!/usr/bin/env tclsh



##
## Rotate backups
##
## @author: Roberto Reale (roberto.reale82@gmail.com)
##


#!/bin/bash


################################################################################
#
# | | | |
# |---.,---.,---.|---.| ,---.|--- ,---.
# | |,---|`---.| || |---'| `---.
# `---'`---^`---'` '`---'`---'`---'`---'
#
#
# Bashlets -- A modular extensible toolbox for Bash
#
# Copyright (c) 2014-6 Roberto Reale
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
################################################################################


################################################################################
#
# rotatebackups
#
#
# Purpose:
#
# TODO
#
# Environment variables:
#
# none
#
# Example of call:
#
# TODO
#
################################################################################




tcl_text='
##
## We require several packages (to be found in the TCLLIB collection).
##
Expand All @@ -23,7 +71,7 @@ package require syslog
## Local configuration
##
set progname "rotate-backups"
set progname "rotatebackups"
set config_file "/etc/$progname.ini"
set version 0.1
set logger_interactive 0
Expand Down Expand Up @@ -158,7 +206,7 @@ proc backup_file {backup_subroot source_file \
}
proc get_config_value {config section key} {
return [string trim [::ini::value $config $section $key] "'\""]
return [string trim [::ini::value $config $section $key] "\""]
}
proc do_backup {config_file} {
Expand Down Expand Up @@ -205,3 +253,8 @@ logger "Starting ..."
do_backup $config_file
## END MAIN PROGRAM
##
'

tclsh <<< "$tcl_text"

# ex: ts=4 sw=4 et filetype=sh noexpandtab

0 comments on commit 053e17a

Please sign in to comment.