{"id":15017023,"url":"https://github.com/rahaaatul/obsync","last_synced_at":"2026-01-21T05:08:28.705Z","repository":{"id":244669141,"uuid":"815914892","full_name":"rahaaatul/obsync","owner":"rahaaatul","description":"Easily sync your Obsidian vault between your desktop and mobile devices leveraging FTP for file transfer.","archived":false,"fork":false,"pushed_at":"2024-06-16T14:30:31.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T07:55:01.843Z","etag":null,"topics":["android","backup","bash","bash-script","ftp","ftp-client","obsidian-md","script","termux","windows"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rahaaatul.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-16T14:12:55.000Z","updated_at":"2024-11-26T14:07:17.000Z","dependencies_parsed_at":"2024-06-16T16:15:54.116Z","dependency_job_id":"3ecc42ed-e059-467d-8b7c-c378ca4d32a3","html_url":"https://github.com/rahaaatul/obsync","commit_stats":null,"previous_names":["rahaaatul/obsync"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rahaaatul/obsync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahaaatul%2Fobsync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahaaatul%2Fobsync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahaaatul%2Fobsync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahaaatul%2Fobsync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rahaaatul","download_url":"https://codeload.github.com/rahaaatul/obsync/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahaaatul%2Fobsync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28627388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","backup","bash","bash-script","ftp","ftp-client","obsidian-md","script","termux","windows"],"created_at":"2024-09-24T19:49:42.192Z","updated_at":"2026-01-21T05:08:28.678Z","avatar_url":"https://github.com/rahaaatul.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/1/10/2023_Obsidian_logo.svg\" width=\"2.7%\" /\u003e Obsync: A Two-Way Obsidian Sync\n\nEasily sync your Obsidian vault between your desktop and mobile device without purchasing Obsidian Sync. This script leverages FTP for file transfer and ensures data integrity with backup capabilities.\n\n### Key Features:\n1. Two-Way Sync: Sync files and folders between desktop and mobile to keep your vault updated on both devices.\n2. Exclusion Rules: Customize which files and folders to exclude from the sync to avoid unnecessary data transfer.\n3. Automated Backup: Create local backups on your Android device before syncing to prevent data loss.\n---\n## Before Reading:\n\u003e [!Important]\n\u003e This guide focuses on **Windows** and **Android**, but the steps can be adapted for other operating systems as well.\n\n\u003e [!Caution]\n\u003e Test this script with a mock vault first to ensure the safety of your data. This precaution helps prevent any accidental loss or corruption of your actual vault. Once you have confirmed that everything works as intended, you can proceed to use your main vault.\n\n\u003e [!TIP]\n\u003e Got a suggestion? Comment below!\n---\n## Requirements\n- **FTP Server running on Desktop** \u003csup\u003e[How to set up an FTP server on Windows?](https://www.windowscentral.com/how-set-and-manage-ftp-server-windows-10)\u003c/sup\u003e\n  \u003e Ensure the Obsidian folder on your desktop is accessible through FTP from your mobile beforehand.\n  \n- **A Terminal in Mobile** (preferably [Termux](https://github.com/KitsunedFox/termux-monet))\n\n## Installation\n1. **Install Required Packages in Termux:**\n    ```sh\n    pkg update \u0026\u0026 pkg install lftp rsync\n    ```\n2. **Create the Sync Script:**\n    ```sh\n    nano obsidian-sync.sh\n    ```\n3. **Add the following code to the script:**\n    \u003e Don't forget to change the configurations in the `FTP server details` and `Patterns to exclude`.\n    \n    ```sh\n    #!/bin/bash\n\n    # FTP server details\n    FTP_HOST=\"ftp://192.168.1.100:21\" # e.g., 192.168.1.100:21\n    FTP_USER=\"user\"\n    FTP_PASS=\"password\"\n    REMOTE_DIR=\"/Documents/Obsidian\" # Obsidian location on Desktop\n    LOCAL_DIR=\"/storage/1BC4-1763/Documents/Obsidian\" # Obsidian location on Mobile\n    BACKUP_DIR=\"/storage/1BC4-1763/Documents/Obsidian-Backup\" # Backup location on Mobile\n\n    # Patterns to exclude\n    EXCLUDE_PATTERNS=(\n       # \"*.tmp\"         # Exclude all .tmp files\n       # \"*.bak\"         # Exclude all .bak files\n       # \"cache/\"        # Exclude cache directory\n       # \"logs/\"         # Exclude logs directory\n       # \"DoNotSync.md\"  # Exclude specific file\n       \".obsidian/\"      # Exclude Obsidian configs\n    )\n\n    # Convert EXCLUDE_PATTERNS to rsync format\n    RSYNC_EXCLUDES=()\n    for pattern in \"${EXCLUDE_PATTERNS[@]}\"; do\n      RSYNC_EXCLUDES+=(--exclude \"$pattern\")\n    done\n\n    # Convert EXCLUDE_PATTERNS to lftp format\n    LFTP_EXCLUDES=\"\"\n    for pattern in \"${EXCLUDE_PATTERNS[@]}\"; do\n      LFTP_EXCLUDES+=\"--exclude $pattern \"\n    done\n\n    # Function to create a backup using rsync\n    backup_files() {\n      rsync -av --delete \"${RSYNC_EXCLUDES[@]}\" \"$LOCAL_DIR/\" \"$BACKUP_DIR/\"\n    }\n\n    # Sync function using lftp\n    sync_files() {\n      lftp -u \"$FTP_USER\",\"$FTP_PASS\" \"$FTP_HOST\" \u003c\u003cEOF\n      set ftp:ssl-allow no\n      mirror --verbose --delete --only-newer --no-perms $LFTP_EXCLUDES \"$REMOTE_DIR\" \"$LOCAL_DIR\"\n      mirror --verbose --reverse --delete --only-newer --no-perms $LFTP_EXCLUDES \"$LOCAL_DIR\" \"$REMOTE_DIR\"\n      quit\n    EOF\n    }\n\n    # Create a backup before syncing\n    backup_files\n\n    # Call sync function\n    sync_files\n    ```\n4. **Make the Script Executable:**\n    ```sh\n    chmod +x obsidian-sync.sh\n    ```\n5. **Run the Script:**\n    ```sh\n    ./obsidian-sync.sh\n    ```\n    \n---\n\n## Automation\nAutomating the sync process ensures that your Obsidian vault stays up-to-date without manual intervention. Here are two methods to automate the script:\n\n### Method 1: Using Cron in Termux\n\nYou can set up a cron job in Termux to run the script at specified intervals. Follow these steps:\n\n1. **Install Cron Package**:\n    ```sh\n    pkg install cronie\n    ```\n\n2. **Start the Cron Daemon**:\n    ```sh\n    crond\n    ```\n\n3. **Edit the Cron Table**:\n    ```sh\n    crontab -e\n    ```\n\n4. **Add a Cron Job**:\n    Add the following line to run the sync script every hour (adjust the schedule as needed):\n    ```sh\n    0 * * * * /data/data/com.termux/files/home/obsidian-sync.sh\n    ```\n\n    This line means \"run the script at the start of every hour.\"\n\n5. **Save and Exit**:\n    Save the changes and exit the editor. Your script will now run automatically based on the specified schedule.\n    \n    \u003e Make sure to keep Termux running in background.\n\n### Method 2: Using Automate/Tasker with Termux:Tasker Plugin\n\nFor a more flexible approach, you can use automation apps like Automate or Tasker along with the Termux:Tasker plugin to run the script based on specific events or conditions.\n\n#### Using Automate:\n1. **Install Automate and Termux**:\n    Download and install [Automate](https://play.google.com/store/apps/details?id=com.llamalab.automate) from the Play Store and the [Termux:Tasker](https://github.com/KitsunedFox/termux-tasker?tab=readme-ov-file#plugin-configuration) plugin from the Play Store.\n\n2. **Create a New Flow in Automate**:\n    Open Automate and create a new flow.\n\n3. **Add a Plug-in action Block**:\n    - Add a \"Plug-in action\" block to the flow.\n    - In the \"Pick plug-in\" field, select Termux.\n    - This will open a new window.\n    - In executable field, place your `/path/to/obsidian-sync.sh`.\n      - You can put your `obsidian-sync.sh` in `/.termux/tasker` to avoid any issue.\n    - Save and exit, both tasker plugin and the flow.\n\n4. **Add a Trigger Block**:\n    Add a trigger block (like \"Time\" for scheduled sync or \"Wi-Fi Connected\" for event-based sync) and connect it to Plug-in action block.\n    \u003e I'll create a flow for this later, I'm tired now.\n5. **Save and Enable the Flow**:\n    Save your flow and enable it. The script will now run automatically based on your defined trigger.\n\n#### Using Tasker:\n1. **Install Tasker and Termux:Tasker Plugin**:\n    Download and install [Tasker](https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm) and the [Termux:Tasker](https://github.com/KitsunedFox/termux-tasker?tab=readme-ov-file#plugin-configuration) plugin from the Play Store.\n\n2. **Create a New Profile in Tasker**:\n    Open Tasker and create a new profile.\n\n3. **Set a Trigger**:\n    - Choose a trigger (like \"Time\" for scheduled sync or \"Wi-Fi Connected\" for event-based sync).\n\n4. **Add a Task**:\n    - Create a new task and add an action.\n    - Select \"Plugin\" -\u003e \"Termux:Tasker\".\n    - Tap the configuration icon and enter the path to your script:\n      ```sh\n      /data/data/com.termux/files/home/obsidian-sync.sh\n      ```\n      - You can put your `obsidian-sync.sh` in `/.termux/tasker` to avoid any issue.\n\n5. **Save and Enable the Profile**:\n    Save your profile and enable it. The script will now run automatically based on the defined trigger.\n\nBy setting up automation, you ensure that your Obsidian vault syncs regularly without manual intervention. Choose the method that best fits your needs and enjoy seamless synchronization across your devices.\n\n\nHope this helps! \n\n---\n\n## What's Next?\n- Add some picture for better understanding.\n- A Video Guide.\n- A Automate flow for Obsync.\n\n---\n\nAlso don't hesitate to comment below for potential improvements or any flaws in the code. Or improve the gist formatting anyway.\n\nThank you 💖","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahaaatul%2Fobsync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frahaaatul%2Fobsync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahaaatul%2Fobsync/lists"}