Problem (Urgent) Automatic backup as cronjob in ubuntu "Problems with mv command"

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Adem Musaoglu

New Member
Jul 29, 2019
86
0
0
Hi there i am using a script which i found in the internet and have modified for my own needs:

Code:
screen -R ftb -X stuff "say Backup starting. World no longer saving... $(printf '\r')"
screen -R ftb -X stuff "save-off $(printf '\r')"
screen -R ftb -X stuff "save-all $(printf '\r')"
sleep 3
cd ~
cd /McMyAdmin/Minecraft/bak
rm -f worldbakhour24.zip
mv -f worldbakhour18.zip worldbakhour24.zip
mv -f worldbakhour12.zip worldbakhour18.zip
mv -f worldbakhour6.zip worldbakhour12.zip
mv -f worldbakhour0.zip worldbakhour6.zip
zip -r /home/ftb/McMyAdmin/Minecraft/bak/worldbakhour0.zip /home/ftb/McMyAdmin/Minecraft/Overworld -x /home/ftb/McMyAdmin/Minecraft/Overworld/DIM-100/**\* /home/ftb/McMyAdmin/Minecraft/Overworld/DIM-19/**\* /home/ftb/McMyAdmin/Minecraft/Overworld/DIM-34/**\* /home/ftb/McMyAdmin/Minecraft/Overworld/DIM-37/**\* /home/ftb/McMyAdmin/Minecraft/Overworld/DIM-38/**\* /home/ftb/McMyAdmin/Minecraft/Overworld/DIM-42/**\* /home/ftb/McMyAdmin/Minecraft/Overworld/DIM-7/**\* /home/ftb/McMyAdmin/Minecraft/Overworld/DIM10/**\* /home/ftb/McMyAdmin/Minecraft/Overworld/DIM-37/**\* /home/ftb/McMyAdmin/Minecraft/Overworld/DIM2/**\* /home/ftb/McMyAdmin/Minecraft/Overworld/DIM8/**\* /home/ftb/McMyAdmin/Minecraft/Overworld/DIM_*/**\* /home/ftb/McMyAdmin/Minecraft/Overworld/Mine/**\*
screen -R ftb -X stuff "save-on $(printf '\r')"
screen -R ftb -X stuff "say Backup complete. World now saving. $(printf '\r')"

I have problems with the are where the mv command is being used in the script.
After starting the script my first zip file "worldbakhour0.zip" is generated well and correct naming.
When i run this script the second time it should rename the "worldbakhour0.zip" into "worldbakhour6.zip". Instead it renames it as follows "worldbakhour6.zip?".
I can rename those files back again if i tab the name i get "worldbakhour0.zip^M". Also the files arent red as my other .zip archives, they are grey.

Can someone give me a hint how to fix the problem with my script ?

The cronjob is working well.
 

The real Orakel

New Member
Jul 29, 2019
1
0
0
Hi there i am using a script which i found in the internet and have modified for my own needs:

I can rename those files back again if i tab the name i get "worldbakhour0.zip^M". Also the files arent red as my other .zip archives, they are grey.

Can someone give me a hint how to fix the problem with my script ?

Hi Adem,

my suggestion is that you have not used the correct settings in your editor. Ensure to use unix style line feed

The ^M indicates you have DOS style CRLF style enabled.

Maybe it helps
The Orakel
 

Adem Musaoglu

New Member
Jul 29, 2019
86
0
0
Thanks for the response. Indeed I made a file in windows a which uses different codes like the return keys. After the change from dos to Unix it was fixed. But thanks for your help.