V
V
Viktor Taran2017-11-18 07:43:14
linux
Viktor Taran, 2017-11-18 07:43:14

Why does the script not work when the folder is mounted?

Since the ssd drives, the site backup simply does not fit, so I immediately mount the external drive as a local device,
mount it in different ways, but it doesn’t really affect

mount -t davfs https://XXXXXXXXXX.your-storagebox.de/ /var/backup

or
mount.cifs -o user=XXXXX,pass=XXXXXXX //XXXXXXXX.your-storagebox.de/ /mnt

The problem appeared unusual.
Backup script refused to work ;(
#!/bin/sh
test ! -d /var/backup/mysql/`date +%Y` && { mkdir -p /var/backup/mysql/`date +%Y` ; }
test ! -d /var/backup/mysql/last && { mkdir -p /var/backup/mysql/last ; }
chmod 600 /var/backup/mysql
chmod 600 /var/backup/mysql/last

for i in `mysql -uroot -pXXXXXXXXX -e'show databases;' | grep -v information_schema | grep -v Database`; do mysqldump -uroot -pXXXXXXX $i > /var/backup/mysql/last/$i.sql;done >> /dev/null 2>> /var/log/sqlbackup.log

cd /var/backup/mysql/
tar -czvf /var/backup/mysql/`date +%Y`/sqldump-`date +%Y-%m-%u`.tar.gz ./last >> /dev/null > /var/log/sqlbackup.log

#  БЭКАП /etca
test ! -d /var/backup/etc/ && { mkdir -p /var/backup/etc/ ; }
DATE=`date +%F`;
BACKUPPATH="/var/backup/etc";
find $BACKUPPATH/ -mtime +60 | xargs rm -f; #удаляет предыдущие бэкапы старше 60 дней.
tar -czvf "$BACKUPPATH/etc.$DATE.tar.gz" /etc/ > /dev/null 2> /dev/null;

This actually appears
mkdir: cannot create directory ‘/var/backup/mysql/2017’: Permission denied
mkdir: cannot create directory ‘/var/backup/mysql/last’: Permission denied
chmod: cannot access ‘/var/backup/mysql/last’: Permission denied
tar: ./last: Cannot stat: Permission denied
tar (child): /var/backup/mysql/2017/sqldump-2017-11-6.tar.gz: Cannot open: Permission denied
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

Well, where to dig? *
Actually, he can’t do anything with the files.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
falsebyte, 2017-11-18
@shambler81

I would say more precisely: you need to dig in the direction of the mounted options. By default, it is mounted with read-only permissions.
If add:
There shouldn't be any problems with the recording.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question