Sync data to Google drive using rclone

Installation

# cd /usr/port/net/rclone
# make install

Create OAuth client id and secret

See: https://rclone.org/drive/#making-your-own-client-id

Setup

Before we start, generate config file first. It’s not necessary to run with root permission.

$ rclone config

See: https://rclone.org/drive/

It will generate config file in $HOME/.config/rclone/rclone.conf

Beware that answer “No” for “Use auto config” when you run rclone on a sever that has no browser installed, or you could not complete the authorization of oauth.

Run

/* gdrive is the name of rclone config */
$ rclone sync --create-empty-src-dirs /nas/staff gdrive:/nas/staff

MySQL backup and restore

Backup

# mysqldump -u root -p [database_name] > backup.sql

– OR –

# mysqldump -u root -p --all-database > backup.sql

– OR –

# mysqldump -u root -p [database_name] --tables [table_name] > backup.sql

Restore

# mysql -u root -p < backup.sql

– OR –

# mysql -u root -p [database_name] < backup.sql