File: mergeall-android-scripts/mergeall-plug-to-data-update.sh

#!/usr/bin/bash
# File: mergeall-plug-to-data-update.sh
#--------------------------------------------------------
# Run the main Mergeall script on Android to make $data
# the same as $plug.  This automatically propagates all 
# changes from your $plug content copy to your $data copy.
# This uses path variables set in your ~/.bash_profile.
# See _README.html for all general usage instructions.
#--------------------------------------------------------

# Load current path settings
source ~/.bash_profile

# Run in work folder for logs
pushd $work > /dev/null
echo "Starting: $PWD"

# Route logfile output here
logdir=Admin-Mergeall

# Filename passed as arg else generated
if [ $# == 1 ]
then
    logname=$1
else
    logname=mergeall-$(date +%Y%m%d-%H%M%S).txt
fi

# Create logfiles dir if needed
if [ ! -e $logdir ] 
then
    mkdir $logdir
    echo "Created $logdir"
fi

# Run and save log, py's -u may or may not help tails
python -u Mergeall-source/mergeall.py \
    $plug \
    $data \
    -auto -backup -quiet -skipcruft \
        > $logdir/$logname

# Back to starting dir
popd > /dev/null
echo "Finished: $PWD"



[Home page] Books Code Blog Python Author Train Find ©M.Lutz