📜 ⬆️ ⬇️

NetBeans: maintaining current versions of files from a remote server via ssh

Good day,% habrauser%!

Anyone who works in this wonderful IDE, sooner or later, wonders: "Why are there no seemingly simple things - automatic file synchronization from a remote server !?"

In the project settings and in the NetBeans settings there is a tick “Enable automatic scanning of source files”, which should solve this problem, but it was not noticed that it had a positive effect.
')
Once, due to the fact that NetBeans simply erased files on the server, those that are saved in the project, the author lost several hours of work, forgetting to update the project. After this annoying misunderstanding, the thought of the wrong situation did not leave me. As a result, a method was born, unfortunately, I cannot integrate it into NetBeans itself, because I don’t know java, and even if I integrate, I’m not like this, but using the built-in diff tools.

The method that was born is more like a crutch than a good solution to the problem, however, he does his job like any other crutch. The first thing that came to mind was the rsync + bat + scheduler, but this black window, which appears every few minutes, was not joyful, began to look for alternative ways and this is what happened:

We will need

for windows:

for linux
Depending on the operating system shell, we set:


Common for winsows and linux

Create a sync.list file in the project folder (it can be named as you please, the main thing is to remember to indicate the corresponding name in the --files-from parameter)

The file contains a list of synchronized directories. Special attention should be paid to the fact that the directories inside should be relative , that is, if the project on the server is in the / sites / site1 folder, and we want to synchronize the / sites / site1 / public and / sites / site1 / app folders, then you just need to write in the file
public
app

Each directory with a new line. All paths will be laid out relative to the one specified in the rsync parameters; this behavior can be changed using command flags.

You can read about crontab settings, for example, here , rsync parameters - here

Windows


Linux


That's all. If your project does not use ssh, but ftp or another protocol, you can use the appropriate programs for this.

Thank you for attention!
Suggestions and suggestions are welcome!

Source: https://habr.com/ru/post/214599/


All Articles