Setup OpenMediaVault to delete any files 60 days old automatically

    • OMV 1.0
    • Setup OpenMediaVault to delete any files 60 days old automatically

      I am wondering if there is a way to run command to automatically delete any files which are 60 days old or older and let say this command would be executed once a month or every 2nd month by the server...

      I have setup OpenMediaVault v.12 (Kralizec) and my DataDisk /dev/sdb1
      I setup in Shared Folder:
      CLPvideo
      Gaitlab
      Ghost

      I would like to have command that will delete any files which are 60 days or older from the CLPvideo folder

      I am not sure how I could do this in the OpenMediaVault. I there is a way could you please advice how I could do this?

      Thank you
    • Hello,

      First thoughts : I would write a shell script which does that and put it on a crontab (you can also use scheduled tasks in OMV)...

      You can use for example this command :

      Source Code

      1. find /media/yourstorage/CLPvideo -mtime +60 -type f -delete


      Becareful with the find command and the -delete option !!! make sure this is the good folder and the good path !!!
      - ASROCK FM2A88X-ITX+ (SATAIII (6Gb/s) x6 (for the DATA), mSATA x1 (for the OS) ==> maybe the only afordable motherboard with 6xSATAIII ports)
      - AMD A6 7400K 3.5GHz (overpowerful for NAS but the cheapest for this motherboard)
      - Corsair 2Go DDR3 1333MHz C9 (x2)
      - INTEL GIGABIT CT DESKTOP ADAPTER SINGLE PORT RJ45 PCIE (to avoid backports problems with network controller)
      - COOLER MASTER G450M (80+ bronze)
      - WD Red 2To 64Mo 3.5" SATAIII (6Gb/s) (x4 for the DATA, 2 SATA ports left for future use)
      - 32 Go SSD mSATA KingSpec Half-Size Solid State (for the OS which allows 6 SATA HDDs)
      - Fractal Design Node 304 black (HDD 3.5" x6)
      - RAID 5 xfs
      - OMV 1.12 (Kralizec) - 3.16.0-0.bpo.4-amd64
    • lmgtfy.com/?q=find+move

      Greetings
      David
      "Well... lately this forum has become support for everything except omv" [...] "And is like someone is banning Google from their browsers"

      Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.


      Upload Logfile via WebGUI/CLI
      #openmediavault on freenode IRC | German & English | GMT+1
      Absolutely no Support via PM!

      I host parts of the omv-extras.org Repository, the OpenMediaVault Live Demo and the pre-built PXE Images. If you want you can take part and help covering the costs by having a look at my profile page.
    • Thank you for the link but also it shows to me to use Google search as well as how lazy I am to use a search engine???
      Sorry, probably I didn't provide enough information when I asked for the command about to move files. Believe it or not Mr. davidh2k I do use Google search on regular basis every day. I would like to thank you for people like you who willing share information and willing help other like me to understand Linux better, I feel novice in Linux, because of this Forum I am able to understand better, discover new possibilities and I am able to manage OpenMediaVault product. Thank you again!

      I found commands to move files but I am not sure which one is correct one for my need.
      I could test it to figure it out... but I thought to ask on this Forum first and I am hoping I will get answer.

      Here it is my extended question:

      Should I use this one? find /media/yourstorage/CLPvideo -mtime +60 -type f -mv '{}' /media/yourstorage/CLPvideo_old

      or should I use this one? find /media/yourstorage/CLPvideo -mtime +60 -type f -exec mv '{}' /media/yourstorage/CLPvideo_old

      I don't understand what -exec means? Even I did search for it but it is not clear to me...

      The post was edited 1 time, last by bksmartit ().

    • exec executes the command you append to it for every file that the find command finds. ;)

      The use of xargs (you don't ask for that) may throw an error if there is no file found that fits your search terms. I haven't used '-mv' myself, so I can't answer what it does different thatn '-exec mv'

      Greetings
      David
      "Well... lately this forum has become support for everything except omv" [...] "And is like someone is banning Google from their browsers"

      Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.


      Upload Logfile via WebGUI/CLI
      #openmediavault on freenode IRC | German & English | GMT+1
      Absolutely no Support via PM!

      I host parts of the omv-extras.org Repository, the OpenMediaVault Live Demo and the pre-built PXE Images. If you want you can take part and help covering the costs by having a look at my profile page.
    • I have tested today and it works for me great!

      this is the command I need for my needs: find /media/yourstorage/CLPvideo -mtime +60 -type f -exec mv '{}' /media/yourstorage/CLPvideo_old \;

      This shell command move any files which are 60 days old and older from /media/yourstorage/CLPvideo to /media/yourstorage/CLPvideo_old

      I thought to share with you.

      Thanks for your help