Script to track daily work items

Work items are logged against a monthly file, so you can quickly see at
a glance what your activities were for the last month
master
nirenjan 2013-09-09 23:58:00 -07:00
parent fec04c7037
commit ce03c06b17
1 changed files with 39 additions and 0 deletions

39
mlog 100755
View File

@ -0,0 +1,39 @@
#!/bin/bash
# Monthly logging script
# Call mlog and it will update a log file
# Set the default mlog folder
[[ -z $MLOG_FOLDER ]] && MLOG_FOLDER="$HOME/mlog"
# Make sure that the folder exists
[[ ! -d $MLOG_FOLDER ]] && mkdir -pv $MLOG_FOLDER
# Make sure that we have a valid TMPDIR
[[ -z $TMPDIR ]] && TMPDIR='/tmp'
# Make sure that we have a valid EDITOR
[[ -z $EDITOR ]] && EDITOR=vim
MLOG_HDR=''
if [[ -x $HOME/bin/stardate ]]
then
[[ -z $MLOG_RANK ]] && MLOG_RANK='Chief Engineer'
MLOG_HDR="$MLOG_RANK's log, Stardate $($HOME/bin/stardate)\n"
fi
MLOG_HDR="$MLOG_HDR[$(date)]"
MLOG_FILE="$TMPDIR/mlog-tmp-$$"
$EDITOR $MLOG_FILE
[[ ! -s $MLOG_FILE ]] && exit 0
MLOG_LOG="$MLOG_FOLDER/$(date +%Y-%m)"
echo -e "$MLOG_HDR\n" >> $MLOG_LOG
cat $MLOG_FILE >> $MLOG_LOG
echo -e "\n----------------------------------------\n" >> $MLOG_LOG