The purpose of the move.sh script is to automatically move files from your server to your google drive account. This is done by default every night at 3:12 am controlled by a cron job.
Editing the Cron Job
- SSH into your server
- Enter in the following commands
sudo su - crontab -e
- You will then see a line stating the following
12 3 * * * /home/${username}/rclone/move.sh
- You can now change the timings for the cron job.
- For help with setting new cron rules use: https://crontab-generator.org/
- In short: * Minutes – * Hours – * Days – * Months – * Weekdays
- Once you are finished you can then just press control and X and then Y to save and edit.
Editing the Script
The move.sh script will be located in /home/USERNAME/rclone/move.sh
- SSH into your server
- Run the following command (Replacing USERNAME with your actual username)
sudo su - cd /home/USERNAME/rclone/ chattr -i move.sh nano move.sh
- You will now be editing the file. The move.sh script flags will look like something below. (This is an un-encrypted example)
/usr/bin/rclone move /home/${username}/rclone/cache gdrive:Media --drive-chunk-size 64M --delete-empty-src-dirs --user-agent user --fast-list --bwlimit 8M -P --log-file=/home/${username}/rclone/move.log -v
Here is a breakdown of the various command and flags that are used.
/usr/bin/rclone move
> instruction rclone to move files.
Options for rclone to Google Drive: MOVE, SYNC & COPY
move
– Will move from source and delete from source to Google Drivesync
– Will sync from source to Google Drive. Meaning if content is not present in source it will get deleted from Google Drivecopy
– Will copy from source to Google Drive 1:1/home/{username}/rclone/cache
> path of sourcegdrive:
> name of remote (Google Drive)--drive-chunk-size 64M
> Upload chunk size. Must a power of 2 >= 256k. (default 8M)--delete-empty-src-dirs
> Delete empty source dirs after move--user-agent user
> Set the user-agent to a specified string. The default is rclone/ version (default “rclone/v1.51.0”) (was an issue with Google Drive once not being specified)--fast-list
> Use recursive list if available. Uses more memory but fewer transactions. (good for speed)--bwlimit 8M
> Bandwidth limit in kBytes/s, or use suffix b|k|M|G or a full timetable. (8M will allow for a continuous 24/7 upload without getting hit by the max 750GB/daily upload limit)-P
> Show progress during transfer. (Prints status in terminal while running)--log-file=/home/${username}/rclone/move.log
> Log everything to this file-v
> Print lots more stuff
More flags can be found at https://rclone.org/flags/
- When you have edited everything that you need, you can save and exit this editor with
ctrl+x
pressY
- Finally, to lock the script again, please enter the following command.
chattr +i move.sh