nextcloudcmd.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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/Debian
  16. ::
  17. $ sudo add-apt-repository ppa:nextcloud-devs/client
  18. $ sudo apt update
  19. $ sudo apt install nextcloud-client
  20. Refer to the link
  21. - https://nextcloud.com/install/#install-clients
  22. - https://launchpad.net/~nextcloud-devs/+archive/ubuntu/client
  23. - https://pkgs.alpinelinux.org/packages?name=nextcloud-client
  24. - https://help.nextcloud.com/t/linux-packages-status/10216
  25. To invoke ``nextcloudcmd``, you must provide the local and the remote repository
  26. URL using the following command::
  27. nextcloudcmd [OPTIONS...] sourcedir nextcloudurl
  28. where ``sourcedir`` is the local directory and ``nextcloudurl`` is
  29. the server URL.
  30. Other command line switches supported by ``nextcloudcmd`` include the following:
  31. ``--user``, ``-u`` ``[user]``
  32. Use ``user`` as the login name.
  33. ``--password``, ``-p`` ``[password]``
  34. Use ``password`` as the password.
  35. ``-n``
  36. Use ``netrc (5)`` for login.
  37. ``--non-interactive``
  38. Do not prompt for questions.
  39. ``--silent``, ``--s``
  40. Inhibits verbose log output.
  41. ``--trust``
  42. Trust any SSL certificate, including invalid ones.
  43. ``--httpproxy http://[user@pass:]<server>:<port>``
  44. Uses ``server`` as HTTP proxy.
  45. ``--nonshib``
  46. Uses Non Shibboleth WebDAV Authentication
  47. ``--davpath [path]``
  48. Overrides the WebDAV Path with ``path``
  49. ``--exclude [file]``
  50. Exclude list file
  51. ``--unsyncedfolders [file]``
  52. File containing the list of un-synced remote folders (selective sync)
  53. ``--max-sync-retries [n]``
  54. Retries maximum n times (defaults to 3)
  55. ``-h``
  56. Sync hidden files, do not ignore them
  57. Credential Handling
  58. ~~~~~~~~~~~~~~~~~~~
  59. ``nextcloudcmd`` requires the user to specify the username and password using the standard URL pattern, e.g.,
  60. ::
  61. $ nextcloudcmd /home/user/my_sync_folder https://carla:secret@server/nextcloud/remote.php/webdav/
  62. To synchronize the Nextcloud directory ``Music`` to the local directory
  63. ``media/music``, through a proxy listening on port ``8080``, and on a gateway
  64. machine using IP address ``192.168.178.1``, the command line would be::
  65. $ nextcloudcmd --httpproxy http://192.168.178.1:8080 \
  66. $HOME/media/music \
  67. https://server/nextcloud/remote.php/webdav/Music
  68. ``nextcloudcmd`` will prompt for the user name and password, unless they have
  69. been specified on the command line or ``-n`` has been passed.
  70. Exclude List
  71. ~~~~~~~~~~~~
  72. ``nextcloudcmd`` requires access to an exclude list file. It must either be
  73. installed along with ``nextcloudcmd`` and thus be available in a system location,
  74. be placed next to the binary as ``sync-exclude.lst`` or be explicitly specified
  75. with the ``--exclude`` switch.
  76. Example
  77. ~~~~~~~~~~~~
  78. - Synchronize a local directory to the specified directory of the nextcloud server
  79. ::
  80. $ nextcloudcmd /home/user/<my_sync_folder> \
  81. https://<username>:<secret>@<server_address>/remote.php/webdav/<Directory_that_has_been_created>