Cron Jobs: Move files to other folder

rsgertos

Cadet
Joined
May 6, 2019
Messages
5
Hi Guys,
I would like to ask if my command is right for moving files to other folders
I have to 2 path:
/mnt/BountyDumping/BountyDumping/
/mnt/BountyDumping/Recycle Bin/

my command is:
mv /mnt/BountyDumping/BountyDumping/* /mnt/BountyDumping/Recycle Bin/

other way i tried is create a script;
#!/bin/sh
mv /mnt/BountyDumping/BountyDumping/* /mnt/BountyDumping/Recycle Bin/

then other the command
find /script/move.sh


Hope you can help me,

Thanks,
 

Heracles

Wizard
Joined
Feb 2, 2018
Messages
1,401
Hi,

Well, is that command right ? Yes and No... It will work first time for sure, but you may end up in trouble once the destination is not empty anymore. Also, you are about to move folders as well. Is that your intent ? As for permission, Root will always be able to do it, but if you run from another user, that may be another potential problem.

Why are you moving your files to a Recycle Bin folder ? An easier way would probably be to take a regular snapshot and then delete the file. The snapshot will keep a copy out of reach and you can recover any file from it. The snapshot will have no problem handling multiple versions of the same file or files with the same name.

I am pretty sure there is a better way to answer your need... Describe more what you are trying to do and why and then we may be able to offer you better solutions.
 

rsgertos

Cadet
Joined
May 6, 2019
Messages
5
Thank you Heracles for your quick response,

Actually aside from that, i want to delete all users folders inside that BountyDumping every sunday but then i want to back up it first in the recycle bin folder just in case they might need to get something there again. Still thinking if this is the best way to do it.
 

Heracles

Wizard
Joined
Feb 2, 2018
Messages
1,401
Hi again,

From what you just wrote, I would say that No, this is not a good option.

What you need here is snapshots. You take them at least one per Sunday (according to your post), but feel free to take more. Also, you keep them for at least 1 week (again only to mimic what you wrote). That way, everything is preserved how you need it and it is pain free.

But why only a single snapshot per week ? Here, I have 5 generation of snapshots.
Snapshot generation 1 is every 15 minutes and saved for 3 days
Snapshot generation 2 is every hour, saved for 1 week
Snapshot generation 3 is every day, saved for 4 months
Snapshot generation 4 is every week, saved for 1 year
Snapshot generation 5 is every month (actually every 4 weeks because month is not a unit in the scheduler) and saved for 4 years

Thanks to that, files can be reverted to as they were 15 minutes before most incidents and I can go back as far as 4 years on the worst cases.

Overall the total number of snapshot is not too big (recommendation is to keep it below 1 000 if you do not wish to search forever before finding whatever you are looking for), precision is very good and coverage is very long.

Should you need to extract anything from one of these snapshots, you just clone it and mount it anywhere you wish. You then go and grab what you need and once done, you destroy the clone.
 

rsgertos

Cadet
Joined
May 6, 2019
Messages
5
Thank you for that idea,

I think i may apply that snapshot once i implement it on all my windows files server. I guess 1 - 2 snapshot is good for my Dumping since its not that important or less priority. If ever can I directly message you regarding freenas. I'm currently on phase 1 for my implementation of Freenas in my company. trying to test it first then possible on phase 2 i will replace 1 by 1 all my file server. Currently still puzzled on my current setup not sure if all my configuration is correct.


In addition.. I have a veritas backup software. that i use in my windows files server. Do you think using snapshot will replace the use of my backup software for all my file server that will be running on freeNAS >? thanks ^_^
 
Last edited:

Heracles

Wizard
Joined
Feb 2, 2018
Messages
1,401
Hi,

In no way FreeNAS can replace a backup. You always need backups, even with FreeNAS. Your Veritas backup is also certainly moved to tapes, so is an offline backup. By definition, that one can not be affected by any online event.

You can send me a direct message, but you will surely be better served by posting to the forum. Many others here can help you and some with more hardware experience than myself. Here, I only bought new Dell Servers. Many did a lot more complex systems than myself. Once you posted in the forum, you can send me a message and a link to it because I am not always online. If I can, it will be a pleasure to help you.

Good luck with your setup,
 
Top