Dropbox offers a client that allows headless servers to sync, see https://www.dropbox.com/install-linux. Does NextCloud offer a similar client that supports End-to-End encryption?
Command line sync client: yes (https://docs.nextcloud.com/desktop/2.3/advancedusage.html)
Supports E2E (en/de)cryption: no
Cryptomator has a command line app and it works well with nextcloud (I use it over the native E2E encryption app).
PS - the command line app only syncs once - you have to re-run it to sync again, or use something like run-one-constantly (linux - http://manpages.ubuntu.com/manpages/trusty/man1/run-one.1.html) to make it run similarly the desktop client