marmots/savecycle.sh

34 lines
470 B
Bash
Raw Normal View History

2011-03-19 00:10:02 +00:00
#!/bin/bash
fnnew="whiteboard.marm.`date "+%F_%H-%M"`"
cd /home/jeremy/marmots
save ()
{
echo save | telnet localhost 20002 &> /dev/null
sleep 5 # wait for save to complete
}
backup ()
{
cp whiteboard.marm $fnnew
gzip $fnnew
}
if [ -e whiteboard.marm ]
then
cp whiteboard.marm whiteboard.marm.old
save
cmp whiteboard.marm whiteboard.marm.old &> /dev/null
if [ $? != 0 ]
then
backup
fi
rm whiteboard.marm.old
else
save
backup
fi