Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 33 lines (23 sloc) 531 Bytes
#!/bin/bash
while true
do
# Is offlineimap ok?
sed '/^$/!h;$!d;g' ~/.offlineimap/log |grep -q -E "^-+$"
if [ "$?" != "0" ]
then
pkill -u "$(id -u)" "offlineimap" >/dev/null 2>&1
fi
# Is offlineimap dead?
pgrep -u "$(id -u)" "offlineimap" >/dev/null 2>&1
if [ "$?" != "0" ]
then
cat <<- EOF >> ~/.offlineimap/log
--------------------------------
offlineimap started: $(date +'%Y-%m-%d %H:%M')
--------------------------------
EOF
nohup offlineimap &>> ~/.offlineimap/log &
fi
sleep 120
done
exit 0