Systemd Mount and cron. Can't access mounted dir

Hy guys. Sorry if it's a duplicate question. I can't find this exact issue using the search.

Let me explain my scenario:
I use rclone to backup my files and databases

I've created a systemd service to mount my Google Drive to /mnt/gdrive path, and it's ok. It works.

So I have a cron job, that executes a script. In that part I have a problem:

My script runs well when I execute it.
My script runs well when cronjob executes it while I'm connected BUT
My script fails when cronjob executes it while I'm NOT connected.

My log files says it cannot find my mounted path (mnt/gdrive).

What I'm missing? Does systemd service should be running when nobody is connected?

What is the problem you are having with rclone?

When bash script run on sheduled cron task when I'm connected Everything works Well. But when cron executes it when no one is connected, the mounted path is not accesible.

What is your rclone version (output from rclone version)

rclone v1.45

  • os/arch: linux/arm
  • go version: go1.11.6

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Raspbian, 32bit

Which cloud storage system are you using? (eg Google Drive)

Google drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

This is part of my script, but as it's a mounted directory, I'm not using rclone commands, is a tar command putting the compressed file directly to mounted folder.

tar -czvf $backup_path/$actual_date"_"$SITE.tar.gz --absolute-names /var/www/$SITE/*

The rclone config contents with secrets removed.

[gdrive]
type = drive
client_id = ###
client_secret = ###
scope = drive
root_folder_id = ###
token = {"access_token":"###","token_type":"Bearer","refresh_token":"###","expiry":"###"}

A log from the command with the -vv flag

It's not a rclone command, so the log does not exists.


Systemd service

[Service]
Type=notify
#Set up environment
Environment=REMOTE_NAME="%i"
Environment=REMOTE_PATH="/"
Environment=MOUNT_DIR="/mnt/%i"
Environment=RCLONE_CONF="%h/.config/rclone/rclone.conf"
Environment=RCLONE_TEMP_DIR="/tmp/rclone/%u/%i"

#Default arguments for rclone mount. Can be overridden in the environment file
Environment=RCLONE_MOUNT_ATTR_TIMEOUT="1s"
#TODO: figure out default for the following parameter
Environment=RCLONE_MOUNT_DAEMON_TIMEOUT="UNKNOWN_DEFULT"
Environment=RCLONE_MOUNT_DIR_CACHE_TIME="5m0s"
Environment=RCLONE_MOUNT_DIR_PERMS="0777"
Environment=RCLONE_MOUNT_FILE_PERMS="0666"
Environment=RCLONE_MOUNT_GID="%G"
Environment=RCLONE_MOUNT_MAX_READ_AHEAD="128k"
Environment=RCLONE_MOUNT_POLL_INTERVAL="1m0s"
Environment=RCLONE_MOUNT_UID="%U"
Environment=RCLONE_MOUNT_UMASK="022"
Environment=RCLONE_MOUNT_VFS_CACHE_MAX_AGE="1h0m0s"
Environment=RCLONE_MOUNT_VFS_CACHE_MAX_SIZE="off"
Environment=RCLONE_MOUNT_VFS_CACHE_MODE="off"
Environment=RCLONE_MOUNT_VFS_CACHE_POLL_INTERVAL="1m0s"
Environment=RCLONE_MOUNT_VFS_READ_CHUNK_SIZE="128M"
Environment=RCLONE_MOUNT_VFS_READ_CHUNK_SIZE_LIMIT="off"
#TODO: figure out default for the following parameter
Environment=RCLONE_MOUNT_VOLNAME="UNKNOWN_DEFULT"

#Overwrite default environment settings with settings from the file if present
EnvironmentFile=-%h/.config/%i.env

#Check that rclone is installed
ExecStartPre=/usr/bin/test -x /usr/bin/rclone

#Check the mount directory
ExecStartPre=/usr/bin/test -d "${MOUNT_DIR}"
ExecStartPre=/usr/bin/test -w "${MOUNT_DIR}"
#TODO: Add test for MOUNT_DIR being empty

#Check the rclone configuration file
ExecStartPre=/usr/bin/test -f "${RCLONE_CONF}"
ExecStartPre=/usr/bin/test -r "${RCLONE_CONF}"
#TODO: add test that the remote is configured for the rclone configuration

#Mount rclone fs
ExecStart=/usr/bin/rclone mount \
            --config="${RCLONE_CONF}" \
#See additional items for access control below for information about the following 2 flags
            --allow-other \
#            --default-permissions \
            --cache-tmp-upload-path="${RCLONE_TEMP_DIR}/upload" \
            --cache-chunk-path="${RCLONE_TEMP_DIR}/chunks" \
            --cache-workers=8 \
            --cache-writes \
            --cache-dir="${RCLONE_TEMP_DIR}/vfs" \
            --cache-db-path="${RCLONE_TEMP_DIR}/db" \
            --no-modtime \
            --drive-use-trash \
            --stats=0 \
            --checkers=16 \
            --bwlimit=40M \
            --dir-cache-time=60m \
            --cache-info-age=60m \
            --attr-timeout="${RCLONE_MOUNT_ATTR_TIMEOUT}" \
#TODO: Include this once a proper default value is determined
#           --daemon-timeout="${RCLONE_MOUNT_DAEMON_TIMEOUT}" \
#            --dir-cache-time="${RCLONE_MOUNT_DIR_CACHE_TIME}" \
#            --dir-perms="${RCLONE_MOUNT_DIR_PERMS}" \
#            --file-perms="${RCLONE_MOUNT_FILE_PERMS}" \
#            --gid="${RCLONE_MOUNT_GID}" \
#            --max-read-ahead="${RCLONE_MOUNT_MAX_READ_AHEAD}" \
#            --poll-interval="${RCLONE_MOUNT_POLL_INTERVAL}" \
#            --uid="${RCLONE_MOUNT_UID}" \
#            --umask="${RCLONE_MOUNT_UMASK}" \
#            --vfs-cache-max-age="${RCLONE_MOUNT_VFS_CACHE_MAX_AGE}" \
#            --vfs-cache-max-size="${RCLONE_MOUNT_VFS_CACHE_MAX_SIZE}" \
#            --vfs-cache-mode="${RCLONE_MOUNT_VFS_CACHE_MODE}" \
#            --vfs-cache-poll-interval="${RCLONE_MOUNT_VFS_CACHE_POLL_INTERVAL}" \
#            --vfs-read-chunk-size="${RCLONE_MOUNT_VFS_READ_CHUNK_SIZE}" \
#            --vfs-read-chunk-size-limit="${RCLONE_MOUNT_VFS_READ_CHUNK_SIZE_LIMIT}" \
#TODO: Include this once a proper default value is determined
#            --volname="${RCLONE_MOUNT_VOLNAME}"
            "${REMOTE_NAME}:${REMOTE_PATH}" "${MOUNT_DIR}"

#Unmount rclone fs
ExecStop=/bin/fusermount -u "${MOUNT_DIR}"

#Restsart info
Restart=on-success
RestartSec=10

[Install]
WantedBy=default.target

your rclone version is very old, you need to update.

I have installed last week using sudo apt install rclone. How can it be so old?

I'd suggest you cut out the middle man and just send it directly if possible rather than relying on the mount to send the data. But this is really just an aside.

tar -czvf - --absolute-names /var/www/$SITE/* | rclone rcat gdrive: $backup_path/$actual_date"_"$SITE.tar.gz -v

https://rclone.org/downloads/#script-download-and-install

Repos are maintained by other people. They are slow.

https://rclone.org/install/

Thans @calisro, its updated now.

What is your rclone version (output from rclone version )

rclone v1.52.1

  • os/arch: linux/arm
  • go version: go1.14.4

I modified my script, but apparently I need flag to use with rclone rcat

 Usage:
  rclone rcat remote:path [flags]

Flags:
  -h, --help   help for rcat

Use "rclone [command] --help" for more information about a command.
Use "rclone help flags" for to see the global flags.
Use "rclone help backends" for a list of supported services.
Command rcat needs 1 arguments maximum: you provided 2 non flag arguments: ["gdrive:" "/mnt/gdrive/www/2020-06-19_11-53-47_batalhaorganizada.com.br.tar.gz"]

Command rcat needs 1 arguments maximum: you provided 2 non flag arguments: ["gdrive:" "/mnt/gdrive/www/2020-06-19_11-53-47_batalhaorganizada.com.br.tar.gz"

You have a space....

Shoudl be like this:
"gdrive:/mnt/gdrive/www/2020-06-19_11-53-47_batalhaorganizada.com.br.tar.gz"

not this:
gdrive: /mnt/gdrive/www/2020-06-19_11-53-47_batalhaorganizada.com.br.tar.gz

Yeah. Sorry. I missed that.

I've edit my script accordingly, but i can't figure out why my tar files are splitted in my google drive.

My Script file.

#!/bin/bash

actual_date=`date "+%Y-%m-%d_%H-%M-%S"`;
backup_path="/mnt/gdrive/www";
logfile="/home/zonaweb/backup.log";

TIMEFORMAT=%R;

for SITE in $(ls /var/www --ignore=lost+found); do echo -n $SITE": " >> $logfile; time (tar -czvf $backup_path/$actual_date"_"$SITE.tar.gz --absolute-names /var/www/$SITE/* | rclone rcat gdrive:www/$actual_date"_"$SITE.tar.gz -v >> $logfile) 2>>$logfile; done

Enable debug logging (-vv) and share the debug log.

2020/06/19 15:24:03 DEBUG : rclone: Version "v1.52.1" starting with parameters ["rclone" "rcat" "gdrive:www/2020-06-19_15-24-03_adequatto.com.br.tar.gz" "-vv"]
2020/06/19 15:24:03 DEBUG : Using config file from "/home/zonaweb/.config/rclone/rclone.conf"
2020/06/19 15:24:04 DEBUG : fs cache: renaming cache item "gdrive:www/" to be canonical "gdrive:www"
2020/06/19 15:24:15 DEBUG : Google drive root 'www': File to upload is small (31448 bytes), uploading instead of streaming
2020/06/19 15:24:17 DEBUG : 2020-06-19_15-24-03_adequatto.com.br.tar.gz: MD5 = 2a711aa7e13ab6fb5da3f03c4831b584 OK
2020/06/19 15:24:17 INFO  : 2020-06-19_15-24-03_adequatto.com.br.tar.gz: Copied (new)
2020/06/19 15:24:17 DEBUG : 6 go routines active
2020/06/19 15:24:17 DEBUG : rclone: Version "v1.52.1" starting with parameters ["rclone" "rcat" "gdrive:www/2020-06-19_15-24-03_batalhaorganizada.com.br.tar.gz" "-vv"]
2020/06/19 15:24:17 DEBUG : Using config file from "/home/zonaweb/.config/rclone/rclone.conf"
2020/06/19 15:24:18 DEBUG : fs cache: renaming cache item "gdrive:www/" to be canonical "gdrive:www"
2020/06/19 15:25:06 DEBUG : 2020-06-19_15-24-03_batalhaorganizada.com.br.tar.gz: Sending chunk 0 length 1063182
2020/06/19 15:25:08 DEBUG : 2020-06-19_15-24-03_batalhaorganizada.com.br.tar.gz: Size and modification time the same (differ by -958.266µs, within tolerance 1ms)
2020/06/19 15:25:08 DEBUG : 5 go routines active
2020/06/19 15:25:08 DEBUG : rclone: Version "v1.52.1" starting with parameters ["rclone" "rcat" "gdrive:www/2020-06-19_15-24-03_bosquedomeier.com.br.tar.gz" "-vv"]
2020/06/19 15:25:08 DEBUG : Using config file from "/home/zonaweb/.config/rclone/rclone.conf"
2020/06/19 15:25:09 DEBUG : fs cache: renaming cache item "gdrive:www/" to be canonical "gdrive:www"
2020/06/19 15:25:17 DEBUG : Google drive root 'www': File to upload is small (28448 bytes), uploading instead of streaming
2020/06/19 15:25:19 DEBUG : 2020-06-19_15-24-03_bosquedomeier.com.br.tar.gz: MD5 = 20816484cfaf29d2c1e943913d17418a OK
2020/06/19 15:25:19 INFO  : 2020-06-19_15-24-03_bosquedomeier.com.br.tar.gz: Copied (new)
2020/06/19 15:25:19 DEBUG : 6 go routines active
2020/06/19 15:25:19 DEBUG : rclone: Version "v1.52.1" starting with parameters ["rclone" "rcat" "gdrive:www/2020-06-19_15-24-03_bts.eng.br.tar.gz" "-vv"]
2020/06/19 15:25:19 DEBUG : Using config file from "/home/zonaweb/.config/rclone/rclone.conf"
2020/06/19 15:25:20 DEBUG : fs cache: renaming cache item "gdrive:www/" to be canonical "gdrive:www"
2020/06/19 15:26:34 DEBUG : 2020-06-19_15-24-03_bts.eng.br.tar.gz: Sending chunk 0 length 563820
2020/06/19 15:26:36 DEBUG : 2020-06-19_15-24-03_bts.eng.br.tar.gz: Size and modification time the same (differ by -864.724µs, within tolerance 1ms)
2020/06/19 15:26:36 DEBUG : 5 go routines active
2020/06/19 15:26:36 DEBUG : rclone: Version "v1.52.1" starting with parameters ["rclone" "rcat" "gdrive:www/2020-06-19_15-24-03_casamentoreal.com.br.tar.gz" "-vv"]
2020/06/19 15:26:36 DEBUG : Using config file from "/home/zonaweb/.config/rclone/rclone.conf"
2020/06/19 15:26:36 DEBUG : fs cache: renaming cache item "gdrive:www/" to be canonical "gdrive:www"
2020/06/19 15:30:03 DEBUG : 2020-06-19_15-24-03_casamentoreal.com.br.tar.gz: Sending chunk 0 length 2669755
2020/06/19 15:30:06 DEBUG : 2020-06-19_15-24-03_casamentoreal.com.br.tar.gz: Size and modification time the same (differ by -278.763µs, within tolerance 1ms)
2020/06/19 15:30:06 DEBUG : 5 go routines active
2020/06/19 15:30:06 DEBUG : rclone: Version "v1.52.1" starting with parameters ["rclone" "rcat" "gdrive:www/2020-06-19_15-24-03_default.tar.gz" "-vv"]
2020/06/19 15:30:06 DEBUG : Using config file from "/home/zonaweb/.config/rclone/rclone.conf"
2020/06/19 15:30:07 DEBUG : fs cache: renaming cache item "gdrive:www/" to be canonical "gdrive:www"
2020/06/19 15:30:09 DEBUG : Google drive root 'www': File to upload is small (2414 bytes), uploading instead of streaming
2020/06/19 15:30:11 DEBUG : 2020-06-19_15-24-03_default.tar.gz: MD5 = dfd7734cb45aa3fbfe28ceb114d2825f OK
2020/06/19 15:30:11 INFO  : 2020-06-19_15-24-03_default.tar.gz: Copied (new)
2020/06/19 15:30:11 DEBUG : 6 go routines active
2020/06/19 15:30:11 DEBUG : rclone: Version "v1.52.1" starting with parameters ["rclone" "rcat" "gdrive:www/2020-06-19_15-24-03_indgoo.com.tar.gz" "-vv"]
2020/06/19 15:30:11 DEBUG : Using config file from "/home/zonaweb/.config/rclone/rclone.conf"
2020/06/19 15:30:13 DEBUG : fs cache: renaming cache item "gdrive:www/" to be canonical "gdrive:www"
2020/06/19 15:37:08 DEBUG : 2020-06-19_15-24-03_indgoo.com.tar.gz: Sending chunk 0 length 1243565
2020/06/19 15:37:10 DEBUG : 2020-06-19_15-24-03_indgoo.com.tar.gz: Size and modification time the same (differ by -111.185µs, within tolerance 1ms)
2020/06/19 15:37:10 DEBUG : 5 go routines active
2020/06/19 15:37:10 DEBUG : rclone: Version "v1.52.1" starting with parameters ["rclone" "rcat" "gdrive:www/2020-06-19_15-24-03_intermusica.com.br.tar.gz" "-vv"]
2020/06/19 15:37:10 DEBUG : Using config file from "/home/zonaweb/.config/rclone/rclone.conf"
2020/06/19 15:37:11 DEBUG : fs cache: renaming cache item "gdrive:www/" to be canonical "gdrive:www"
2020/06/19 15:39:53 DEBUG : 2020-06-19_15-24-03_intermusica.com.br.tar.gz: Sending chunk 0 length 720858
2020/06/19 15:39:55 DEBUG : 2020-06-19_15-24-03_intermusica.com.br.tar.gz: Size and modification time the same (differ by -102.88µs, within tolerance 1ms)
2020/06/19 15:39:55 DEBUG : 5 go routines active
2020/06/19 15:39:55 DEBUG : rclone: Version "v1.52.1" starting with parameters ["rclone" "rcat" "gdrive:www/2020-06-19_15-24-03_pedroleo.com.br.tar.gz" "-vv"]
2020/06/19 15:39:55 DEBUG : Using config file from "/home/zonaweb/.config/rclone/rclone.conf"
2020/06/19 15:39:56 DEBUG : fs cache: renaming cache item "gdrive:www/" to be canonical "gdrive:www"
2020/06/19 15:41:21 DEBUG : 2020-06-19_15-24-03_pedroleo.com.br.tar.gz: Sending chunk 0 length 141288
2020/06/19 15:41:22 DEBUG : 2020-06-19_15-24-03_pedroleo.com.br.tar.gz: Size and modification time the same (differ by -248.755µs, within tolerance 1ms)
2020/06/19 15:41:22 DEBUG : 5 go routines active
2020/06/19 15:41:22 DEBUG : rclone: Version "v1.52.1" starting with parameters ["rclone" "rcat" "gdrive:www/2020-06-19_15-24-03_realitybrasil.com.br.tar.gz" "-vv"]
2020/06/19 15:41:22 DEBUG : Using config file from "/home/zonaweb/.config/rclone/rclone.conf"
2020/06/19 15:41:23 DEBUG : fs cache: renaming cache item "gdrive:www/" to be canonical "gdrive:www"
2020/06/19 15:42:53 DEBUG : 2020-06-19_15-24-03_realitybrasil.com.br.tar.gz: Sending chunk 0 length 2408187
2020/06/19 15:42:56 DEBUG : 2020-06-19_15-24-03_realitybrasil.com.br.tar.gz: Size and modification time the same (differ by -770.77µs, within tolerance 1ms)
2020/06/19 15:42:56 DEBUG : 5 go routines active
2020/06/19 15:42:56 DEBUG : rclone: Version "v1.52.1" starting with parameters ["rclone" "rcat" "gdrive:www/2020-06-19_15-24-03_remope.com.br.tar.gz" "-vv"]
2020/06/19 15:42:56 DEBUG : Using config file from "/home/zonaweb/.config/rclone/rclone.conf"
2020/06/19 15:42:57 DEBUG : fs cache: renaming cache item "gdrive:www/" to be canonical "gdrive:www"
2020/06/19 15:42:59 DEBUG : Google drive root 'www': File to upload is small (6111 bytes), uploading instead of streaming
2020/06/19 15:43:01 DEBUG : 2020-06-19_15-24-03_remope.com.br.tar.gz: MD5 = ac24077ca80545502567766be35957bf OK
2020/06/19 15:43:01 INFO  : 2020-06-19_15-24-03_remope.com.br.tar.gz: Copied (new)
2020/06/19 15:43:01 DEBUG : 5 go routines active
2020/06/19 15:43:01 DEBUG : rclone: Version "v1.52.1" starting with parameters ["rclone" "rcat" "gdrive:www/2020-06-19_15-24-03_yatta.eng.br.tar.gz" "-vv"]
2020/06/19 15:43:01 DEBUG : Using config file from "/home/zonaweb/.config/rclone/rclone.conf"
2020/06/19 15:43:02 DEBUG : fs cache: renaming cache item "gdrive:www/" to be canonical "gdrive:www"
2020/06/19 15:43:03 DEBUG : Google drive root 'www': File to upload is small (197 bytes), uploading instead of streaming
2020/06/19 15:43:05 DEBUG : 2020-06-19_15-24-03_yatta.eng.br.tar.gz: MD5 = 8e346033b7cb16843c54e63a89bc2e28 OK
2020/06/19 15:43:05 INFO  : 2020-06-19_15-24-03_yatta.eng.br.tar.gz: Copied (new)
2020/06/19 15:43:05 DEBUG : 6 go routines active
2020/06/19 15:43:05 DEBUG : rclone: Version "v1.52.1" starting with parameters ["rclone" "rcat" "gdrive:www/2020-06-19_15-24-03_zonaweb.com.br.tar.gz" "-vv"]
2020/06/19 15:43:05 DEBUG : Using config file from "/home/zonaweb/.config/rclone/rclone.conf"
2020/06/19 15:43:06 DEBUG : fs cache: renaming cache item "gdrive:www/" to be canonical "gdrive:www"
2020/06/19 15:43:47 DEBUG : 2020-06-19_15-24-03_zonaweb.com.br.tar.gz: Sending chunk 0 length 487639
2020/06/19 15:43:49 DEBUG : 2020-06-19_15-24-03_zonaweb.com.br.tar.gz: Size and modification time the same (differ by -600.269µs, within tolerance 1ms)
2020/06/19 15:43:49 DEBUG : 5 go routines active

As you can see in the image bellow, there is multiple files for each /www/var directory

Here is my script.

zonaweb@zwpi4:~ $ cat backup_www.sh 
#!/bin/bash

actual_date=`date "+%Y-%m-%d_%H-%M-%S"`;
backup_path="/mnt/gdrive/www";
logfile="/home/zonaweb/backup.log";

TIMEFORMAT=%R; for SITE in $(ls /var/www --ignore=lost+found); do tar -czvf $backup_path/$actual_date"_"$SITE.tar.gz --absolute-names /var/www/$SITE/* | rclone rcat gdrive:www/$
actual_date"_"$SITE.tar.gz -vv; done

Can you run this please?

rclone lsjson gdrive:www

and

ls /var/www --ignore=lost+found

It simple looks like you're getting duplicates because its replacing existing files. See these line?

2020/06/19 15:30:11 DEBUG : 2020-06-19_15-24-03_default.tar.gz: MD5 = dfd7734cb45aa3fbfe28ceb114d2825f OK
2020/06/19 15:30:11 INFO  : 2020-06-19_15-24-03_default.tar.gz: Copied (new)

That copied it new. Which is what I expect.

This is replacing an existing file. That shouldn't exist if it hasn't been created yet.

2020/06/19 15:37:08 DEBUG : 2020-06-19_15-24-03_indgoo.com.tar.gz: Sending chunk 0 length 1243565
2020/06/19 15:37:10 DEBUG : 2020-06-19_15-24-03_indgoo.com.tar.gz: Size and modification time the same (differ by -111.185µs, within tolerance 1ms)

Are you running this multiple times on top of itself? Google drive allows duplicates and it looks like that's what you're getting.

[
{"Path":"$","Name":"$","Size":28448,"MimeType":"application/octet-stream","ModTime":"2020-06-19T18:49:48.994Z","IsDir":false,"ID":"1Xzwp4jToyPDMcDVJmAH9L7qI-ZzYuPdN"},
{"Path":"2020-06-15_15-26-37_adequatto.com.br.tar.gz","Name":"2020-06-15_15-26-37_adequatto.com.br.tar.gz","Size":19413406,"MimeType":"application/gzip","ModTime":"2020-06-15T18:26:37.354Z","IsDir":false,"ID":"1VfPp9M4-52-Zz9TAFKKsWEqZ_Kfvkn52"},
{"Path":"2020-06-15_15-26-37_batalhaorganizada.com.br.tar.gz","Name":"2020-06-15_15-26-37_batalhaorganizada.com.br.tar.gz","Size":94834838,"MimeType":"application/gzip","ModTime":"2020-06-15T18:26:51.112Z","IsDir":false,"ID":"1s-u481BoSjR_5aZe8M2rNL7mlfsNHaLK"},
{"Path":"2020-06-15_15-26-37_bosquedomeier.com.br.tar.gz","Name":"2020-06-15_15-26-37_bosquedomeier.com.br.tar.gz","Size":10436510,"MimeType":"application/gzip","ModTime":"2020-06-15T18:27:47.040Z","IsDir":false,"ID":"1oCjEzwaR7jDENF474ZtjQw1shhHkAiU7"},
{"Path":"2020-06-15_15-26-37_bts.eng.br.tar.gz","Name":"2020-06-15_15-26-37_bts.eng.br.tar.gz","Size":137395972,"MimeType":"application/gzip","ModTime":"2020-06-15T18:27:55.248Z","IsDir":false,"ID":"1orqOK_S35Z0BFw-7lZSBWN2uYmzECLC7"},
{"Path":"2020-06-15_15-26-37_casamentoreal.com.br.tar.gz","Name":"2020-06-15_15-26-37_casamentoreal.com.br.tar.gz","Size":411596471,"MimeType":"application/gzip","ModTime":"2020-06-15T18:29:09.420Z","IsDir":false,"ID":"1QWQxN-LjVoZ1gLUnoRaAV5lHEywwSsxe"},
{"Path":"2020-06-15_15-26-37_default.tar.gz","Name":"2020-06-15_15-26-37_default.tar.gz","Size":393401,"MimeType":"application/gzip","ModTime":"2020-06-15T18:33:03.394Z","IsDir":false,"ID":"14HXLPlfWf0YXFlOMfk027Z4cZjp6YD6A"},
{"Path":"2020-06-15_15-26-37_indgoo.com.tar.gz","Name":"2020-06-15_15-26-37_indgoo.com.tar.gz","Size":791236335,"MimeType":"application/gzip","ModTime":"2020-06-15T18:33:05.358Z","IsDir":false,"ID":"11VZR1d96HLXd-0ISdBbUxKz2n34v1yN9"},
{"Path":"2020-06-15_15-26-37_intermusica.com.br.tar.gz","Name":"2020-06-15_15-26-37_intermusica.com.br.tar.gz","Size":250199580,"MimeType":"application/gzip","ModTime":"2020-06-15T18:42:52.904Z","IsDir":false,"ID":"1JNYPEDZweDRpcGjq6VWrg9XDhzGs1KKV"},
{"Path":"2020-06-15_15-26-37_pedroleo.com.br.tar.gz","Name":"2020-06-15_15-26-37_pedroleo.com.br.tar.gz","Size":145475972,"MimeType":"application/gzip","ModTime":"2020-06-15T18:47:23.031Z","IsDir":false,"ID":"1IZCjLam0DSuBV7ACGjcdmc7hGJEuLAo4"},
{"Path":"2020-06-15_15-26-37_realitybrasil.com.br.tar.gz","Name":"2020-06-15_15-26-37_realitybrasil.com.br.tar.gz","Size":148619535,"MimeType":"application/gzip","ModTime":"2020-06-15T18:49:14.283Z","IsDir":false,"ID":"1THipOWI04ZTNlWRzmr3FuYXRSfQzHINX"},
{"Path":"2020-06-15_15-26-37_remope.com.br.tar.gz","Name":"2020-06-15_15-26-37_remope.com.br.tar.gz","Size":3671546,"MimeType":"application/gzip","ModTime":"2020-06-15T18:50:56.331Z","IsDir":false,"ID":"1QMZ06KQgXnRdTjn2c7ZwSRNAtDftBtiI"},
{"Path":"2020-06-15_15-26-37_yatta.eng.br.tar.gz","Name":"2020-06-15_15-26-37_yatta.eng.br.tar.gz","Size":636,"MimeType":"application/gzip","ModTime":"2020-06-15T18:51:00.624Z","IsDir":false,"ID":"1Bdw9c0OyHDUO-n50_EUSsAzmutx13MIW"},
{"Path":"2020-06-15_15-26-37_zonaweb.com.br.tar.gz","Name":"2020-06-15_15-26-37_zonaweb.com.br.tar.gz","Size":69561039,"MimeType":"application/gzip","ModTime":"2020-06-15T18:51:02.683Z","IsDir":false,"ID":"1_TUJRdeSRVbWBGe28-JOaAcR0cCfsKDv"},
{"Path":"2020-06-18_14-16-01_adequatto.com.br.tar.gz","Name":"2020-06-18_14-16-01_adequatto.com.br.tar.gz","Size":19413406,"MimeType":"application/gzip","ModTime":"2020-06-18T17:16:09.432Z","IsDir":false,"ID":"1NqlDdr_A1-454McXjspxAuV7-VvSsIOD"},
{"Path":"2020-06-18_14-16-01_batalhaorganizada.com.br.tar.gz","Name":"2020-06-18_14-16-01_batalhaorganizada.com.br.tar.gz","Size":94861982,"MimeType":"application/gzip","ModTime":"2020-06-18T17:16:21.086Z","IsDir":false,"ID":"1bRbtnAkFos44smfEuJp4ErExV9dUgxr-"},
{"Path":"2020-06-18_14-16-01_bosquedomeier.com.br.tar.gz","Name":"2020-06-18_14-16-01_bosquedomeier.com.br.tar.gz","Size":10443659,"MimeType":"application/gzip","ModTime":"2020-06-18T17:17:09.261Z","IsDir":false,"ID":"1vg42i2ioVaAHb4ahxs41nOU4TVAvm5eT"},
{"Path":"2020-06-18_14-16-01_bts.eng.br.tar.gz","Name":"2020-06-18_14-16-01_bts.eng.br.tar.gz","Size":137395972,"MimeType":"application/gzip","ModTime":"2020-06-18T17:17:17.242Z","IsDir":false,"ID":"1oXlV50XWWLY7dN9phRfa6aAUl1E7aL20"},
{"Path":"2020-06-18_14-16-01_casamentoreal.com.br.tar.gz","Name":"2020-06-18_14-16-01_casamentoreal.com.br.tar.gz","Size":411630811,"MimeType":"application/gzip","ModTime":"2020-06-18T17:18:30.353Z","IsDir":false,"ID":"1vK4CIIeKzbviq6FV7dZDp6IGodbRQfm8"},
{"Path":"2020-06-18_14-16-01_default.tar.gz","Name":"2020-06-18_14-16-01_default.tar.gz","Size":400821,"MimeType":"application/gzip","ModTime":"2020-06-18T17:21:45.625Z","IsDir":false,"ID":"1n5hhmq4i5z3v85m0b-tZHf-XDuvDS4Rq"},
{"Path":"2020-06-18_14-16-01_indgoo.com.tar.gz","Name":"2020-06-18_14-16-01_indgoo.com.tar.gz","Size":791260861,"MimeType":"application/gzip","ModTime":"2020-06-18T17:21:48.079Z","IsDir":false,"ID":"16r2MXvXSOyftxb9YGvwtgCtLlgVo3fXw"},
{"Path":"2020-06-18_14-16-01_intermusica.com.br.tar.gz","Name":"2020-06-18_14-16-01_intermusica.com.br.tar.gz","Size":250237970,"MimeType":"application/gzip","ModTime":"2020-06-18T17:28:00.338Z","IsDir":false,"ID":"1yJILkE5-YtoRXkBDXBjHi1h_Ljbv1Vx8"},
{"Path":"2020-06-18_14-16-01_pedroleo.com.br.tar.gz","Name":"2020-06-18_14-16-01_pedroleo.com.br.tar.gz","Size":145479018,"MimeType":"application/gzip","ModTime":"2020-06-18T17:30:12.668Z","IsDir":false,"ID":"1RzsXiBkFOL6vEq1N5xi7lgNe4tBVU9di"},
{"Path":"2020-06-18_14-16-01_realitybrasil.com.br.tar.gz","Name":"2020-06-18_14-16-01_realitybrasil.com.br.tar.gz","Size":149044636,"MimeType":"application/gzip","ModTime":"2020-06-18T17:31:22.643Z","IsDir":false,"ID":"1Op9zjm44ORYryUccg8PTum24us1hmxxy"},
{"Path":"2020-06-18_14-16-01_remope.com.br.tar.gz","Name":"2020-06-18_14-16-01_remope.com.br.tar.gz","Size":3678025,"MimeType":"application/gzip","ModTime":"2020-06-18T17:32:36.056Z","IsDir":false,"ID":"16VCi4YjBGbm6ZOUZjhrSI9Tin5GxcZPj"},
{"Path":"2020-06-18_14-16-01_yatta.eng.br.tar.gz","Name":"2020-06-18_14-16-01_yatta.eng.br.tar.gz","Size":636,"MimeType":"application/gzip","ModTime":"2020-06-18T17:32:39.980Z","IsDir":false,"ID":"1EgttXbvkQHG4VvAWbE60LDzUXurYSnvK"},
{"Path":"2020-06-18_14-16-01_zonaweb.com.br.tar.gz","Name":"2020-06-18_14-16-01_zonaweb.com.br.tar.gz","Size":70672449,"MimeType":"application/gzip","ModTime":"2020-06-18T17:32:42.126Z","IsDir":false,"ID":"1JC7p6JSh_HyNNVnnkIn8b5YIOP7bT-Qs"},
{"Path":"2020-06-19_15-24-03_adequatto.com.br.tar.gz","Name":"2020-06-19_15-24-03_adequatto.com.br.tar.gz","Size":31448,"MimeType":"application/gzip","ModTime":"2020-06-19T18:24:04.004Z","IsDir":false,"ID":"1yeR-uWozRbOfxOJEFwh5MOp-JdNCkesE"},
{"Path":"2020-06-19_15-24-03_batalhaorganizada.com.br.tar.gz","Name":"2020-06-19_15-24-03_batalhaorganizada.com.br.tar.gz","Size":1063182,"MimeType":"application/gzip","ModTime":"2020-06-19T18:24:18.205Z","IsDir":false,"ID":"1GOV5t-jybjsOxRb69ULH4Sp0UasoQhEq"},
{"Path":"2020-06-19_15-24-03_batalhaorganizada.com.br.tar.gz","Name":"2020-06-19_15-24-03_batalhaorganizada.com.br.tar.gz","Size":94873578,"MimeType":"application/gzip","ModTime":"2020-06-19T18:24:17.039Z","IsDir":false,"ID":"11Mp_EGlNcFZsVlgh8CX__t9rt9OqdHPE"},
{"Path":"2020-06-19_15-24-03_bosquedomeier.com.br.tar.gz","Name":"2020-06-19_15-24-03_bosquedomeier.com.br.tar.gz","Size":28448,"MimeType":"application/gzip","ModTime":"2020-06-19T18:25:09.430Z","IsDir":false,"ID":"1G5pZNq77jpfENmIZ5LH9nFvR6DifchEC"},
{"Path":"2020-06-19_15-24-03_bts.eng.br.tar.gz","Name":"2020-06-19_15-24-03_bts.eng.br.tar.gz","Size":563820,"MimeType":"application/gzip","ModTime":"2020-06-19T18:25:20.789Z","IsDir":false,"ID":"1vFQZ6qIGdGjBQOHXClj_GOSO2KpZzAcV"},
{"Path":"2020-06-19_15-24-03_bts.eng.br.tar.gz","Name":"2020-06-19_15-24-03_bts.eng.br.tar.gz","Size":137395972,"MimeType":"application/gzip","ModTime":"2020-06-19T18:25:19.746Z","IsDir":false,"ID":"17iaCeeuQQc869SEnDRxU2LndEbUKNt0Y"},
{"Path":"2020-06-19_15-24-03_casamentoreal.com.br.tar.gz","Name":"2020-06-19_15-24-03_casamentoreal.com.br.tar.gz","Size":2669755,"MimeType":"application/gzip","ModTime":"2020-06-19T18:26:36.992Z","IsDir":false,"ID":"1m2TrMMobD06qgDF1B4WJ3JWfdOJmuNA8"},
{"Path":"2020-06-19_15-24-03_casamentoreal.com.br.tar.gz","Name":"2020-06-19_15-24-03_casamentoreal.com.br.tar.gz","Size":411649128,"MimeType":"application/gzip","ModTime":"2020-06-19T18:26:36.792Z","IsDir":false,"ID":"171m88jB3arrbaiZ52L6PdUFOsmdvLyw4"},
{"Path":"2020-06-19_15-24-03_default.tar.gz","Name":"2020-06-19_15-24-03_default.tar.gz","Size":2414,"MimeType":"application/gzip","ModTime":"2020-06-19T18:30:07.382Z","IsDir":false,"ID":"1J6j4QIBkXyU3YLtl-rFyXPJMpRiJrP5P"},
{"Path":"2020-06-19_15-24-03_indgoo.com.tar.gz","Name":"2020-06-19_15-24-03_indgoo.com.tar.gz","Size":1243565,"MimeType":"application/gzip","ModTime":"2020-06-19T18:30:13.075Z","IsDir":false,"ID":"1NeQSL6le8inIBDh9d1_EsqdksYh6e6aZ"},
{"Path":"2020-06-19_15-24-03_indgoo.com.tar.gz","Name":"2020-06-19_15-24-03_indgoo.com.tar.gz","Size":791270483,"MimeType":"application/gzip","ModTime":"2020-06-19T18:30:11.766Z","IsDir":false,"ID":"1T7L8yHaBxeF0Ta4ZwFmnhhS2uyiGbUWU"},
{"Path":"2020-06-19_15-24-03_intermusica.com.br.tar.gz","Name":"2020-06-19_15-24-03_intermusica.com.br.tar.gz","Size":250246642,"MimeType":"application/gzip","ModTime":"2020-06-19T18:37:11.696Z","IsDir":false,"ID":"1sJbhXVXPVMkvc_umKS0ZFLmsVfhxh7b3"},
{"Path":"2020-06-19_15-24-03_intermusica.com.br.tar.gz","Name":"2020-06-19_15-24-03_intermusica.com.br.tar.gz","Size":720858,"MimeType":"application/gzip","ModTime":"2020-06-19T18:37:11.546Z","IsDir":false,"ID":"1gaK0_IompYgy-MsZr-1sdArMvcxn1HzM"},
{"Path":"2020-06-19_15-24-03_pedroleo.com.br.tar.gz","Name":"2020-06-19_15-24-03_pedroleo.com.br.tar.gz","Size":141288,"MimeType":"application/gzip","ModTime":"2020-06-19T18:39:56.681Z","IsDir":false,"ID":"1G6vh3xbexGmgUclk06vQU5CMFZTwPTWn"},
{"Path":"2020-06-19_15-24-03_pedroleo.com.br.tar.gz","Name":"2020-06-19_15-24-03_pedroleo.com.br.tar.gz","Size":145480486,"MimeType":"application/gzip","ModTime":"2020-06-19T18:39:56.097Z","IsDir":false,"ID":"1je1Gei8w-MYDmZRunhmp78m0c0FWeLtm"},
{"Path":"2020-06-19_15-24-03_realitybrasil.com.br.tar.gz","Name":"2020-06-19_15-24-03_realitybrasil.com.br.tar.gz","Size":2408187,"MimeType":"application/gzip","ModTime":"2020-06-19T18:41:23.660Z","IsDir":false,"ID":"1CWmtuGVkESXHK4R9p-xzoIRFgAxp5oVT"},
{"Path":"2020-06-19_15-24-03_realitybrasil.com.br.tar.gz","Name":"2020-06-19_15-24-03_realitybrasil.com.br.tar.gz","Size":149207416,"MimeType":"application/gzip","ModTime":"2020-06-19T18:41:23.367Z","IsDir":false,"ID":"1EihHRoOggo791bD0Dvo-m4pnDXsyLfTk"},
{"Path":"2020-06-19_15-24-03_remope.com.br.tar.gz","Name":"2020-06-19_15-24-03_remope.com.br.tar.gz","Size":6111,"MimeType":"application/gzip","ModTime":"2020-06-19T18:42:57.130Z","IsDir":false,"ID":"1Pukt60tuc6Lbs17_0rbGQ0U6hFZ5mnfu"},
{"Path":"2020-06-19_15-24-03_yatta.eng.br.tar.gz","Name":"2020-06-19_15-24-03_yatta.eng.br.tar.gz","Size":197,"MimeType":"application/gzip","ModTime":"2020-06-19T18:43:02.415Z","IsDir":false,"ID":"1bCWCk4fDxDrDNzxJwHOKd8Qb90kYmhVk"},
{"Path":"2020-06-19_15-24-03_zonaweb.com.br.tar.gz","Name":"2020-06-19_15-24-03_zonaweb.com.br.tar.gz","Size":487639,"MimeType":"application/gzip","ModTime":"2020-06-19T18:43:06.718Z","IsDir":false,"ID":"1lu-lHaDsCuCV1kwn7szUUDpM2J4GOz-3"},
{"Path":"2020-06-19_15-24-03_zonaweb.com.br.tar.gz","Name":"2020-06-19_15-24-03_zonaweb.com.br.tar.gz","Size":72851924,"MimeType":"application/gzip","ModTime":"2020-06-19T18:43:05.801Z","IsDir":false,"ID":"1j9iHeTRBag7G2Q1M-8Lyp_rgHyRIPYog"},
{"Path":"2020-06-19_15-48-43_adequatto.com.br.tar.gz","Name":"2020-06-19_15-48-43_adequatto.com.br.tar.gz","Size":19413406,"MimeType":"application/gzip","ModTime":"2020-06-19T18:48:44.242Z","IsDir":false,"ID":"1gub6AFH6LFcVsNujE9MD0iMpZsS3adqu"},
{"Path":"2020-06-19_15-48-43_batalhaorganizada.com.br.tar.gz","Name":"2020-06-19_15-48-43_batalhaorganizada.com.br.tar.gz","Size":94873660,"MimeType":"application/gzip","ModTime":"2020-06-19T18:48:59.523Z","IsDir":false,"ID":"1TfQzxGakRdO6hzAcVjwESU2L93tlpNmC"},
{"Path":"2020-06-19_15-48-43_bosquedomeier.com.br.tar.gz","Name":"2020-06-19_15-48-43_bosquedomeier.com.br.tar.gz","Size":10445295,"MimeType":"application/gzip","ModTime":"2020-06-19T18:49:48.153Z","IsDir":false,"ID":"1gddUwopTzlWO42ZE2iV_oYQ9dhUYbQb6"},
{"Path":"2020-06-19_15-48-43_bts.eng.br.tar.gz","Name":"2020-06-19_15-48-43_bts.eng.br.tar.gz","Size":15892480,"MimeType":"application/gzip","ModTime":"2020-06-19T18:49:57.123Z","IsDir":false,"ID":"1eAmAAVqqfsooP4iCAwtYYqggzrgo2TVu"}
]
adequatto.com.br  batalhaorganizada.com.br  bosquedomeier.com.br  bts.eng.br  casamentoreal.com.br  default  indgoo.com  intermusica.com.br  pedroleo.com.br  realitybrasil.com.br  remope.com.br  yatta.eng.br  zonaweb.com.br

No. The command is inside a for from ls/var/www --ignore=lost+found. I have tested only by running ./backup_www.sh, wich is this script above.

You should check your script.

Here you're taring /var/www/$SITE/ and sending it to a gdrive mount. Then you're taking that file and sending it again to gdrive directly.

tar -czvf $backup_path/$actual_date"_"$SITE.tar.gz --absolute-names /var/www/$SITE/* | rclone rcat gdrive:www/$actual_date"_"$SITE.tar.gz -vv

If you are going to send it direct, then do that.

tar -czvf - --absolute-names /var/www/$SITE/* | rclone rcat gdrive:www/$actual_date"_"$SITE.tar.gz -vv

OTherwise go back to writing it to your mount without rclone rcat and debug why your mount is dropping which shouldn't happen anyway.

1 Like

Thank you so much! I was not seeint it. I'm a kind of a linux newbie and did not know I can write de tar command like this.

It worked for what I want. I'll drop the automount in systemd now because I really don't need.

Good. Glad it's working. :grinning:

If it's not asking too much, can I do something like it, for sqldump, directly to gdrive:db too?

mysql -u #### -p#### -e 'show databases' -s --skip-column-names); do time (mysqldump $DB -u #### -p#### > $backup_path/$actual_date"_"$DB.sql

I dont know how to put rclone command after > for the .sql files location.

This:

mysqldump $DB -u #### -p#### > $backup_path/$actual_date"_"$DB.sql

would become this:

mysqldump $DB -u #### -p#### | rclone rcat gdrive:dumps/$actual_date"_"$DB.sql

1 Like