|
52 | 52 | - [Synchronisation](#synchronisation)
|
53 | 53 | - [Basic Usage](#basic-usage)
|
54 | 54 | - [Sync Script Custom Flags](#sync-script-custom-flags)
|
| 55 | + - [Background Sync Job](#background-sync-jobs) |
55 | 56 | - [Uninstall](#Uninstall)
|
56 | 57 | - [Reporting Issues](#reporting-issues)
|
57 | 58 | - [Contributing](#contributing)
|
@@ -633,6 +634,42 @@ Note: Flags that use pid number as input should be used at last, if you are not
|
633 | 634 |
|
634 | 635 | </details>
|
635 | 636 |
|
| 637 | +#### Background Sync Jobs |
| 638 | + |
| 639 | +There are basically two ways to start a background, first one we already covered in the above section. |
| 640 | + |
| 641 | +It will indefinitely run until and unless the host machine is rebooted. |
| 642 | + |
| 643 | +Now, a systemd service service can also be created which will start sync job after boot. |
| 644 | + |
| 645 | +1. Install the systemd unit file `sudo cp -v gsync.service /etc/systemd/system/` |
| 646 | + |
| 647 | +1. Open `/etc/systemd/system/gsync.service` with an editor of your choice and modify the following: |
| 648 | + |
| 649 | + - line 7, line 10 : User and ExecStart |
| 650 | + |
| 651 | + Change `user` to your username where gupload is installed |
| 652 | + |
| 653 | + - line 10 : ExecStart |
| 654 | + |
| 655 | + Change foldername to the local folder which will be synced |
| 656 | + |
| 657 | + Add additional flags like -d for gdrive_folder, etc as per the requirements, use whatever supported by gsync |
| 658 | + |
| 659 | + - line 11 : ExecStop |
| 660 | + |
| 661 | + Add everything which was added in line 10 ( ExecStart ) and add --kill to the end. |
| 662 | + |
| 663 | + e.g: If ExecStart was `ExecStart=/home/user/.google-drive-upload/bin/gsync /home/user/foldername -d drive_folder`, then ExecStop will be `ExecStart=/home/user/.google-drive-upload/bin/gsync /home/user/foldername -d drive_folder --kill` |
| 664 | + |
| 665 | +1. Reload the systemctl daemon so it can see your new systemd unit `sudo systemctl daemon-reload` |
| 666 | + |
| 667 | +1. Start the service `sudo systemctl start gsync` |
| 668 | + |
| 669 | + This is same as starting a sync job with command itself as mentioned in previous section. |
| 670 | + |
| 671 | +1. If you want the bot to automatically start on boot, run `sudo systemctl enable gsync` |
| 672 | + |
636 | 673 | ## Uninstall
|
637 | 674 |
|
638 | 675 | If you have followed the automatic method to install the script, then you can automatically uninstall the script.
|
|
0 commit comments