Created
May 19, 2019 05:26
-
-
Save Eerovil/36d109d531659d24bfafea7111b12e90 to your computer and use it in GitHub Desktop.
Script to run thyme and store data for each day.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
filename=/home/eero/Documents/thyme/`date "+%Y-%m-%d"`.json | |
# Backup previous original file if it contains a { | |
if [ -e $filename ] && grep -q { $filename; then | |
cp $filename "$filename".bak | |
else | |
echo "Corrupted/missing original file!" | |
if [ -e "$filename".bak ]; then | |
echo "replaced!" | |
cp "$filename".bak $filename | |
elif [ -e $filename ]; then | |
echo "removed" | |
rm $filename | |
else | |
echo "did nothing" | |
fi | |
fi | |
# Run thyme on orig file | |
/home/eero/go/bin/thyme track -o $filename | |
chown eero:eero $filename | |
chmod 664 $filename |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment