pomodoro: Store past task in a log file.
This commit is contained in:
parent
c977c43cc4
commit
b6ed6a2094
|
@ -8,6 +8,7 @@ Some useful scripts (for me) that can be added to $PATH :)
|
||||||
* firewall: A script shell to set some iptables rules.
|
* firewall: A script shell to set some iptables rules.
|
||||||
* update-dynmotd.d/: scripts to update the motd (via the /etc/update-motd.d directory).
|
* update-dynmotd.d/: scripts to update the motd (via the /etc/update-motd.d directory).
|
||||||
* flac_to_mp3: convert all flac files of a directory into mp3.
|
* flac_to_mp3: convert all flac files of a directory into mp3.
|
||||||
|
* pomodoro: Print a task and a timer in a file. Try to apply Pomodoro Technique!
|
||||||
* snapsend.sh: Send a ZFS snapshot to a remote host.
|
* snapsend.sh: Send a ZFS snapshot to a remote host.
|
||||||
* test_ssl3: Test if a website supportes the SSLV3 protocol.
|
* test_ssl3: Test if a website supportes the SSLV3 protocol.
|
||||||
* veille.sh: Kill every sensitive process and files then lock the screen.
|
* veille.sh: Kill every sensitive process and files then lock the screen.
|
||||||
|
|
17
pomodoro.sh
17
pomodoro.sh
|
@ -6,6 +6,8 @@ DELAY=25
|
||||||
|
|
||||||
# Log informations
|
# Log informations
|
||||||
LOG_DIR="${HOME}/.pomodoro"
|
LOG_DIR="${HOME}/.pomodoro"
|
||||||
|
LOG_TASK_NAME=$(date +"week-%V-%Y.txt")
|
||||||
|
LOG_TASK_PATH="${LOG_DIR}/${LOG_TASK_NAME}"
|
||||||
|
|
||||||
# Task information (name, path, …)
|
# Task information (name, path, …)
|
||||||
TASK_NAME="${1}"
|
TASK_NAME="${1}"
|
||||||
|
@ -13,7 +15,7 @@ TASK_PATH="${LOG_DIR}/current.task"
|
||||||
|
|
||||||
# Create the log dir
|
# Create the log dir
|
||||||
if [ ! -f "${LOG_DIR}" ]; then
|
if [ ! -f "${LOG_DIR}" ]; then
|
||||||
touch "${LOG_DIR}"
|
mkdir -p -- "${LOG_DIR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create the task file
|
# Create the task file
|
||||||
|
@ -21,12 +23,23 @@ if [ ! -f "${TASK_PATH}" ]; then
|
||||||
touch "${TASK_PATH}"
|
touch "${TASK_PATH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Create the task log file
|
||||||
|
if [ ! -f "${LOG_TASK_PATH}" ]; then
|
||||||
|
touch "${LOG_TASK_PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start working
|
||||||
|
startedTime=$(date +"%H:%M")
|
||||||
|
|
||||||
# Tiny timer
|
# Tiny timer
|
||||||
while [ "${TIME}" != "${DELAY}" ]
|
while [ "${TIME}" != "${DELAY}" ]
|
||||||
do
|
do
|
||||||
printf '%b' "${TASK_NAME}\n${TIME}" > "${TASK_PATH}"
|
printf '%b' "${TASK_NAME}\n${TIME}" > "${TASK_PATH}"
|
||||||
sleep 60
|
sleep 1
|
||||||
TIME=$((TIME+1))
|
TIME=$((TIME+1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Write logs
|
||||||
|
printf '%b' "$(date +"%A (%F) $startedTime → %H:%M") $TASK_NAME" >> "${LOG_TASK_PATH}"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue