docker-feed2imap/entrypoint.sh

33 lines
716 B
Bash
Raw Normal View History

2019-07-15 20:03:39 +00:00
#!/bin/bash
# stop service and clean up here
function shut_down() {
reset
echo "exited $0"
exit 0
}
# USE the trap if you need to also do manual cleanup after the service is stopped,
# or need to start multiple services in the one container
trap "shut_down" SIGINT SIGTERM SIGKILL
2024-09-06 19:34:22 +00:00
echo "update-ca-certificates..."
update-ca-certificates
2019-07-15 20:03:39 +00:00
echo "Launching feed2imap..."
/usr/bin/feed2imap -f /root/feed2imaprc
last=$(date +%s)
while true
do
sleep 3
#echo $last
# if date '+%s'` - $last > 1800 (seconds) ==> feed2imap and $last = date '+%s'`
if [ $(($(date +%s) - $last)) -gt 1800 ]
then
echo "Launching feed2imap..."
/usr/bin/feed2imap -f /root/feed2imaprc
last=$(date +%s)
fi
done
shut_down