tblancher's timetracker timekeeping system
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
692 B

#!/bin/bash
PATH=/Users/tblancher/homebrew/opt/coreutils/libexec/gnubin:/Users/tblancher/bin:/Users/tblancher/homebrew/bin:/Users/tblancher/homebrew/sbin:/Users/tblancher/gem/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/sbin:/usr/sbin:/Users/tblancher/bin
if [ "x$1" == "x" ]; then
MONTH=$(( $(date +%-m) - 1 ))
else
MONTH=$1
shift
fi
if [ "x$1" == "x" ]; then
YEAR=$(date +%Y)
CURR=1
else
YEAR=$1
shift
CURR=0
fi
if [ $MONTH -eq 0 ];
then
MONTH=12
fi
if [ ${CURR} -eq 1 ] && [ $(( $(date +%-m) - $MONTH )) -le 0 ]; then
YEAR=$(( $YEAR - 1))
fi
if [ $MONTH -lt 10 ];
then
MONTH=0$MONTH
fi
tar -cvJf $YEAR-$MONTH.tar.xz $YEAR-$MONTH-*.log --remove-files