Open Dinip opened 5 years ago
Hello, I am also not running the bot on the same machine as my minecraft server, did you managed to solve this issue?
nope... I'm not using anything now... we just have the chat in game
my bad...
I’m on mobile right now but could you perhaps use a combo of
curl -u user:passwd “ftp://server:port/logs/latest.log” 2> /dev/null | tail -F
?
I’ve used CURL to grep latest.log before... but I’m not sure if you can get a constant stream from it until I can try it.
Edit: tried it, doesn’t work
I’m on mobile right now but could you perhaps use a combo of curl -u user:passwd “ftp://server:port/logs/latest.log” 2> /dev/null | tail -F?
I’ve used CURL to grep latest.log before... but I’m not sure if you can get a constant stream from it until I can try it.
Edit: tried it, doesn’t work
I found a program that lets you tail over ftp .. its called ftptail and is written in Perl, you need to install 'Term::ReadKey' from CPan.
Perhaps it will help... requires a bit of argument tweaking but is pretty doable.
Example:
./ftptail -n 3 -s 5 -p path/to/file-containing-passwd sampletext@example.com/logs/latest.log > path/for/latest.log
-n 3
is the line count to grab, I set it to 3
-s 5
is the check period (in seconds), I set it to 5
The main limitation is that it does not have the equivalent to tail's -F
argument, so as soon as the file rolls the program closes, you either need to build a watchdog or have it in a while true
loop.
I currently use this for one of my servers that I can only get FTP access, and works decently .. I haven't seen a lot of players talking at the same time, then I would probably need to tweak the check period. I had an issue where skulker was sending multiple messages to discord if i kept the line count too high, I put it to 3 and it just worked and I haven't played around with it since ... you could probably bump it up to 5 or so.
Hello, Since I have minecraft hosted on a minecraft dedicated host (verygames) I can't use the
tail -F /PATH_TO_MINECRAFT_SERVER_INSTALL/logs/latest.log | grep --line-buffered ": <" | while read x ; do echo -ne $x | curl -X POST -d @- http://YOUR_URL/minecraft/hook ; done
command on minecraft machine. I've mounted the ftp directory to a linux server that I own and tried to use the log file as a local file but it was not "reading" it and displaying on discord. I found this on the internet. Seems that when a remote directory is mounted there is a diferent filesystem provided by FUSE. https://unix.stackexchange.com/questions/347554/doing-a-tail-f-on-a-text-file-over-sshfs-not-working-why This is the error that shows on trying to run the bot with local file reading from the mounted directory: Is there any way to adapt the index.js to read this? Thanks! đź‘Ť