ubuntu as correctly insert test,e



  • I don't know how to put the test right. If in folder /mnt/srv/basket/1c, he'll give me a message that the files haven't been recorded.

    violin

    #!/bin/bash
    fname=`date +%Y-%m-%d`
    echo $fname
    

    mkdir -p /mnt/srv/basket/1c/$fname —mode=777
    for f in /mnt/backup/1c/.bak
    do
    ff=${f##
    /}
    zip -r /mnt/srv/basket/1c/$fname/${ff%.*}.zip $f » /mnt/srv/basket/1c/$fname/$fname.log
    done
    echo "email" | mail -s "BackUp Log File $fname" name.mail@mail.ru < /mnt/srv/basket/1c/$fname/$fname.log ;



    1. You have a mistake:

      zip -r /mnt/srv/basket/1c/$fname/${ff%.*}.zip $f » /mnt/srv/basket/1c/$fname/$fname.log
      

      Redirected (without cutting the file) by the operator >>not printing »

    2. I understand that you need to process a mistake in the performance of this particular team: when it comes to sending a letter and finishing the violin. This can be done, for example:

      zip ... >> ... || {
        res=$?
        mail -s "backup error $res" name.mail@mail.ru" < \
        /mnt/srv/basket/1c/$fname/$fname.log
        exit $res
      }
      
    3. There's another mistake. echo "email" | - extra:

      echo "email" | mail -s "BackUp Log File $fname" name.mail@mail.ru < /mnt/srv/baske
      

      Enough:

      mail -s "BackUp Log File $fname" name.mail@mail.ru < /mnt/srv/baske
      



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2