So I play on a minecraft server that keeps crashing, then rolling back, losing about 30 minutes of data. I don't own the server I'm just writing it for him. So I'm trying to have the script make a back up of the server every 5 minutes as long as it is bigger than the back up, since as more things are done the folder size increases and when it rolls back it decreases.
cd path
worldsize1=[du -s world]
worldsize2=[du -s world]
while [[$worldsize1 -lt $worldsize2 || $worldsize1 -eq $worldsize2]];do
worldsize1=[du -s world]
while [[$SECONDS % 300 -ne 0]];do
done
mkdir tempworld
cp world /tempworld/
cd path/tempworld
mv world copiedworld
cd path
mv tempworld/copiedworld copiedworld
rmdir tempworld
worldsize2=[du -s world]
done
The variables path and world are the only things that will be substituted. I'm quite new to this, and I'm coding this for Solaris while running ubuntu.