marmots/savecycle.sh

34 lines
474 B
Bash
Raw Normal View History

2011-03-19 00:10:02 +00:00
#!/bin/bash
fnnew="whiteboard.marm.`date "+%F_%H-%M"`"
2020-06-27 16:05:34 +00:00
cd /home/jeremy/src/marmots
2011-03-19 00:10:02 +00:00
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