aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/hooks/pre-load
blob: 38edea07d1a44031d6ac7d80354d178413132b4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
#
# This is an example hook. It synchronizes calcurse with a CalDAV server before
# loading the data files.
#
# In order to install this hook, copy this file to
# $XDG_CONFIG_HOME/calcurse/hooks/ (~/.config/calcurse/hooks/) or
# ~/.calcurse/hooks/ if using ~/.calcurse.

cd "$HOME"/.calcurse/

# Do not do anything when synchronizing with a CalDAV server.
[ -f caldav/lock ] && exit

# Run the CalDAV synchronization script in the background.
if [ -d caldav -a -x "$(which calcurse-caldav)" ]; then
	(
		date="$(date +'%b %d %H:%M:%S')"
		echo "$date Running calcurse-caldav from the pre-load hook..."
		calcurse-caldav
		echo
	) >>caldav/log 2>&1 &
fi