Add line to remote txt-file

morpheus93

Client
Регистрация
25.01.2012
Сообщения
557
Благодарностей
72
Баллы
28
I run ZP on one server and need to add line by line to a textfile that is located on another server. What is the easiest approach to do that? Thank you.
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 068
Благодарностей
965
Баллы
113
I run ZP on one server and need to add line by line to a textfile that is located on another server. What is the easiest approach to do that? Thank you.
The database is the correct way.
Other possibilities is dropbox, but if your bots work simultaneous or with more than one thread then this will make problems.
Another way is to use FTP.
 
  • Спасибо
Реакции: morpheus93

morpheus93

Client
Регистрация
25.01.2012
Сообщения
557
Благодарностей
72
Баллы
28
Thank you lokiys for your help. Yes, I already considered the problems that can occure with multithreading or a couple of bots are using the same file...
Database solution should workaround this problem? But then I have to alter a bunch of my projects and their logic.
With FTP... would that be "multi-threading/access" safe?

Saw an tutorial using C# on how to add a line to an (external) text-file. But looks quite complicated and not sure if this also works on a remote server.
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 068
Благодарностей
965
Баллы
113
Thank you lokiys for your help. Yes, I already considered the problems that can occure with multithreading or a couple of bots are using the same file...
Database solution should workaround this problem? But then I have to alter a bunch of my projects and their logic.
With FTP... would that be "multi-threading/access" safe?

Saw an tutorial using C# on how to add a line to an (external) text-file. But looks quite complicated and not sure if this also works on a remote server.
I do not think FTP would be good in multithreading too. It ll depends on your logic, but think if you will use the same file from two different places file should be locked when one side is working with it, otherwise, You will have problems, it does not really matter what solution you use.
To be honest with database same story, DB should be locked when one side is working with data. If you will use simple DB action what you can find in zennoposter then this is not bullet-proof solution. anyway. Again all depends on your thread count and logic.

The easiest way that comes in mind would be to use separate files on each server and then use just one threaded bot that updates some main file.
The same approach I would make for DB, each bot would have separate tables and then some method that updates the main table with info from both tables.

In any way, DB is the best solution.
 
  • Спасибо
Реакции: morpheus93

morpheus93

Client
Регистрация
25.01.2012
Сообщения
557
Благодарностей
72
Баллы
28
I think I will try a DB solution or maybe have a look again in the C# thing. Also found something about an solution via Powershell and cmdlet that is supposed to add lines to a remote text-file but haven't tested it yet.

If it works I will post it here.

Thank you.
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
17 601
Благодарностей
4 329
Баллы
113
I suggest you using Google tables.
We've added it in version 7.1.1.0. which is available as test build currently.
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 068
Благодарностей
965
Баллы
113

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
17 601
Благодарностей
4 329
Баллы
113
@VladZen Thanks for the hint. But I can't download the Beta of V7 from the link you posted (it says that the Dropbox folder is empty).
Updated test version is already available - https://www.dropbox.com/sh/sepjz186mxb5hlg/AADG1C4Ip2ASmWn1H79ch1T6a?dl=0

Does it work good in multithreading?
It works quite good in multithreading for adding/getting lines.
 

morpheus93

Client
Регистрация
25.01.2012
Сообщения
557
Благодарностей
72
Баллы
28
Okay thank you Vlad, I will check it out.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)