nextcloudcmd.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. The Nextcloud Client packages contain a command line client, ``nextcloudcmd``, that can
  2. be used to synchronize Nextcloud files to client machines.
  3. ``nextcloudcmd`` performs a single *sync run* and then exits the synchronization
  4. process. In this manner, ``nextcloudcmd`` processes the differences between
  5. client and server directories and propagates the files to bring both
  6. repositories to the same state. Contrary to the GUI-based client,
  7. ``nextcloudcmd`` does not repeat synchronizations on its own. It also does not
  8. monitor for file system changes.
  9. Install ``nextcloudcmd``
  10. ~~~~~~~~~~~~~~~~~~~~~~~~
  11. CentOS
  12. ::
  13. $ sudo yum -y install epel-release
  14. $ sudo yum -y install nextcloud-client
  15. Ubuntu
  16. ::
  17. $ sudo add-apt-repository ppa:nextcloud-devs/client
  18. $ sudo apt update
  19. $ sudo apt install nextcloud-client
  20. Debian
  21. ::
  22. $ sudo apt install nextcloud-desktop-cmd
  23. Refer to the link
  24. - https://nextcloud.com/install/#install-clients
  25. - https://launchpad.net/~nextcloud-devs/+archive/ubuntu/client
  26. - https://pkgs.alpinelinux.org/packages?name=nextcloud-client
  27. - https://help.nextcloud.com/t/linux-packages-status/10216
  28. To invoke ``nextcloudcmd``, you must provide the local and the remote repository
  29. URL using the following command::
  30. nextcloudcmd [OPTIONS...] sourcedir nextcloudurl
  31. where ``sourcedir`` is the local directory and ``nextcloudurl`` is
  32. the server URL.
  33. Other command line switches supported by ``nextcloudcmd`` include the following:
  34. ``--path``
  35. Overrides default remote root folder to a specific subfolder on the server(e.g.: /Documents would sync the Documents subfolder on the server)
  36. ``--user``, ``-u`` ``[user]``
  37. Use ``user`` as the login name.
  38. ``--password``, ``-p`` ``[password]``
  39. Use ``password`` as the password.
  40. ``-n``
  41. Use ``netrc (5)`` for login.
  42. ``--non-interactive``
  43. Do not prompt for questions.
  44. ``--silent``, ``--s``
  45. Inhibits verbose log output.
  46. ``--trust``
  47. Trust any SSL certificate, including invalid ones.
  48. ``--httpproxy http://[user@pass:]<server>:<port>``
  49. Uses ``server`` as HTTP proxy.
  50. ``--exclude [file]``
  51. Exclude list file
  52. ``--unsyncedfolders [file]``
  53. File containing the list of un-synced remote folders (selective sync)
  54. ``--max-sync-retries [n]``
  55. Retries maximum n times (defaults to 3)
  56. ``-h``
  57. Sync hidden files, do not ignore them
  58. Credential Handling
  59. ~~~~~~~~~~~~~~~~~~~
  60. ``nextcloudcmd`` requires the user to specify the username and password using the standard URL pattern, e.g.,
  61. ::
  62. $ nextcloudcmd /home/user/my_sync_folder https://carla:secret@server/nextcloud
  63. To synchronize the Nextcloud directory ``Music`` to the local directory
  64. ``media/music``, through a proxy listening on port ``8080``, and on a gateway
  65. machine using IP address ``192.168.178.1``, the command line would be::
  66. $ nextcloudcmd --httpproxy http://192.168.178.1:8080 --path /Music \
  67. $HOME/media/music \
  68. https://server/nextcloud
  69. ``nextcloudcmd`` will prompt for the user name and password, unless they have
  70. been specified on the command line or ``-n`` has been passed.
  71. Exclude List
  72. ~~~~~~~~~~~~
  73. ``nextcloudcmd`` requires access to an exclude list file. It must either be
  74. installed along with ``nextcloudcmd`` and thus be available in a system location,
  75. be placed next to the binary as ``sync-exclude.lst`` or be explicitly specified
  76. with the ``--exclude`` switch.
  77. Example
  78. ~~~~~~~~~~~~
  79. - Synchronize a local directory to the specified directory of the nextcloud server
  80. ::
  81. $ nextcloudcmd --path /<Directory_that_has_been_created> /home/user/<my_sync_folder> \
  82. https://<username>:<secret>@<server_address>