2

1] I want to create a script which matches the today's date >> with server's date format.

2] If it matches then, it will create the folder named "$date" itself in the mentioned path "/tmp/test/files/testing/".

3] Moreover, it will search for the files which are created by today's date with the help of "find" command from "/var/www/path" and take the back up with the help of the rsync command of those files into /mnt/ folder.

I'm kinda new shell scripter however, kindly help me with the script.

________________________________________________________________________________

What I've did until now is :>>>>>>>

##!/bin/bash 
now=$(date +"%m_%d_%Y")


mkdir /tmp/test/files/testing/"date +%b%Y%m%d"/$now &&


find . -type f -newermt 2019-06-10 -ls -exec rsync -avzh {} /mnt/Data/exes/10-June-2019/ \;  &&

mysqldump -h localhost -u username -ppassword production > /mnt/Data/date +%b%Y%m%d/productionDate.sql

________________________________________________________________________________

Thanks, Bakula

PerlDuck
  • 13,335
bakula
  • 21
  • 3
  • 4
    What do you have so far? Which part of this is giving you trouble? Please [edit] your question and show us what you have written so we don't tell you things you already know. – terdon Jun 10 '19 at 11:52
  • I'm bit confused that if this script would work but, I've tried to create as per what I've asked for. :

    [

    #!/bin/bash now=$(date +"%m_%d_%Y")

    mkdir /tmp/test/files/testing/"date +%b%Y%m%d"/$now &&

    mysqldump -h localhost -u username -ppassword production > /mnt/Data/date +%b%Y%m%d/productionDate.sql &&

    find . -type f -newermt 2019-06-10 -ls -exec rsync -avzh {} /mnt/Data/exes/10-June-2019/ ;
    ]

    – bakula Jun 10 '19 at 12:29
  • I wanted to create this script just because, I would be running it every day at evening around 7 pm. Could you please guide me with steps? – bakula Jun 10 '19 at 12:42
  • Please *[edit]* your question and show us what you have. as you can see, it's impossible to read in the comments. – terdon Jun 10 '19 at 12:57
  • Okay, as you mentioned, I've updated my question with the work I've did until now on it. Kindly help me. Thanks. – bakula Jun 10 '19 at 13:09

0 Answers0