mirror of https://github.com/nirenjan/dotfiles.git
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 monthmaster
parent
29fc3c0bb2
commit
d37bb6c9ce
1
install
1
install
|
@ -221,6 +221,7 @@ mkfolder ~/bin
|
|||
|
||||
# Install scripts
|
||||
lnfile scripts/beep ~/bin/
|
||||
lnfile scripts/mlog ~/bin/
|
||||
lnfile scripts/stardate ~/bin/
|
||||
lnfile scripts/settitle ~/bin/
|
||||
lnfile scripts/smartwd ~/bin/
|
||||
|
|
|
@ -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
|
||||
|
Loading…
Reference in New Issue