rejetto forum

The Throwback (retro) template. With large folder and mobile support.

danny · 129 · 150565

0 Members and 2 Guests are viewing this topic.

Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
Write protecting the hfs.ini file was not effective

i have no idea of what happens if you set that file read-only, it's not a case that was considered


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
the temp files you are talking about are because i don't  immediately overwrite the file, but create a temp file and then rename it.
It's a common technique to avoid totally losing a file.
The process probably fails at the moment it tries to rename to hfs.ini because was marked as read-only.
If nonetheless you want to stay like this but gets these leftovers, i can only suggest to add an "event script" each minute to delete all *.tmp


Offline danny

  • Tireless poster
  • ****
    • Posts: 281
    • View Profile
the temp files you are talking about are because i don't  immediately overwrite the file, but create a temp file and then rename it.  It's a common technique to avoid totally losing a file. The process probably fails at the moment it tries to rename to hfs.ini because was marked as read-only. If nonetheless you want to stay like this but gets these leftovers, i can only suggest to add an "event script" each minute to delete all *.tmp
I was trying to make a watchdog (including settings stabilizer) which did not do a write loop.  But, I'm not actually a good programmer, so I didn't figure this out yet. 


Offline danny

  • Tireless poster
  • ****
    • Posts: 281
    • View Profile
This is good to keep the forum community healthy and to keep the post sanity :) (This thread has currently almost 42k views, and those who come back to download your Throwback template will now have your template available again). I appreciate your comment, and that you have restored the good-willing...
Thanks again for your help.

Here is original Throwback11MP and Throwback11basic, which are older, but may have reference value.

However, the newer version is located: http://rejetto.com/forum/index.php?topic=12055.msg1065284#msg1065284
« Last Edit: February 28, 2020, 06:45:36 PM by danny »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
I was trying to make a watchdog (including settings stabilizer) which did not do a write loop.  But, I'm not actually a good programmer, so I didn't figure this out yet. 

i meant an event script in HFS like this

Code: [Select]
[every 1 minute]
{.delete|*.tmp.}

but i fear the 'delete' command doesn't support wildcards.
I don't have sources right now and the documentation tells nothing about it.
If it doesn't, you'll have to use also the {.dir.} command or, easier, use {.exec|del *.tmp.}  or something similar


Offline danny

  • Tireless poster
  • ****
    • Posts: 281
    • View Profile
The windows hosts file modification -or- the dnsmasq alternative all work to stabilize the settings.  So, a watchdog wasn't needed for that particular case.


Even so, a standard keepalive/ping watchdog could be a nice feature to consider. Perhaps there is a simple batch file method?

Here's a batch used to run a sync-backup for a WiFi nas. It shows the errorlevel loop reset to 0 by the successful ver command and the sync which may or may not be successful over WiFi (but it will loop until success).
@echo off
:ONE
timeout /t 30 /NOBREAK
VER > nul
robocopy \\source\folder D:\destination /e /copy:DT /xo /purge /w:0 /r:0
IF %ERRORLEVEL% NEQ 0 GOTO ONE

I put that sample, because the errorlevel isn't well documented for batch.

Now for watchdog
I'm fairly sure the ping command exits with an errorlevel of some sort, and then there's the tskill command to exit a program gently or taskkill to exit an unresponsive program.
added function
It seems possible to make a safety copy of hfs.ini at the batch start.
And, then after tskill and 2 seconds timeout (sleep without loading cpu), reverse the copy before starting hfs. So, if settings caused the server to freeze, functional settings and server would be restored to working order automatically.

I haven't figured out the particulars yet
But, this type of watchdog could allow for the automatic updates and settings. It would revert changes that didn't work or keep any that did work.
That approach seems more reasonable than a few other things that I have tried. 


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 842
  • Status: On hiatus (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
So, if settings caused the server to freeze, functional settings and server would be restored to working order automatically.
Although it's always recommended doing a backup of hfs.ini file, the whole problem/issue you had (about the freeze), was a very exceptional one. And it would never happen again if you follow what I've posted HERE. Have you read that? You currently have your Private Message disabled on the forum (User 'danny' has blocked your personal message.), so I couldn't let you know about the updated post.
Please keep your PM open... ::) :D

Cheers,
Leo.-
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.


Offline danny

  • Tireless poster
  • ****
    • Posts: 281
    • View Profile
Although it's always recommended doing a backup of hfs.ini file, the whole problem/issue you had (about the freeze), was a very exceptional one. And it would never happen again if you follow what I've posted HERE. Have you read that? ...
Please keep your PM open... ::) :D
Thanks.  I fixed the PM, (probably).

I read your post, although I was scratching my head because I tried setting ip-services= to my preference; and that would keep for many hours, appeared fixed, but then it reverted itself later.  Also, what is the function of ip-services-time= ?? 

P.S.
I think that the watchdog/keepalive idea would help the gigabit people and other download-fast + browse concurrency related freezes.  Windows can't ping a port, but wget could be used to fetch the favicon or some other little bit and may be able to return a dos errorlevel (which would operate the tskill+restart subroutine). 


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 842
  • Status: On hiatus (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
I read your post, although I was scratching my head because I tried setting ip-services= to my preference; and that would keep for many hours, appeared fixed, but then it reverted itself later.  Also, what is the function of ip-services-time= ??
As far I know, ip-services-time= keeps a record/log of the last time ip-services= was updated. By setting it up to a future date, like '99999.99999' (which is 13/10/2173 23:59:59 in Delphi date format), 'ip-services' won't be updated until that date.

About the Watchdog thing, sorry, I currently don't understand what are you trying to archive with it, but I guess some other user could help you out... :-\ ???

Cheers,
Leo.-
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.


Offline danny

  • Tireless poster
  • ****
    • Posts: 281
    • View Profile
...By setting it up to a future date, like '99999.99999' (which is 13/10/2173 23:59:59 in Delphi date format), 'ip-services' won't be updated until that date.
THANKS!!!  I set both of the time entries to the year 2173
I guess that was the missing? opt-out function.
About the Watchdog thing, sorry, I currently don't understand what are you trying to archive with it...
Ping hfs locally +  Restart hfs if no response. 

Just the usual standard keep-alive function. 
« Last Edit: February 20, 2020, 12:11:12 PM by danny »


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 842
  • Status: On hiatus (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
Ping hfs locally +  Restart hfs if no response. 
Just the usual standard keep-alive function.
Ah, now I understand. 8) You can start by reading THIS.
Then add the following, somewhere in your template:

Code: [Select]
[ping|no log]
{
    "pong" : 1
}

And inside a batch, access/ping periodically with wget (with the appropriate arguments) this URL: http://127.0.0.1/~ping

I have almost no experience using wget to give you more help. But it could be useful for the rest of users here, if you can share the final working code you end using (so, if anyone here in the future ask the same question, it will find the solution).

I hope you could get more help from some experienced wget user... :-\
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
I guess that was the missing? opt-out function.Ping hfs locally +  Restart hfs if no response. 

the opt-out function exists, it's "external-ip-server".
You are misusing the other 2 options to get the same result.
Try my advice and see if you get the same. If you do, then that's the right way.
I'm only 99% sure because i didn't try, it's old stuff i barely remember (by reading the source code).
As already said: "ip-services" is not an option/setting, is not designed for people to change, it's the software's internal storing (having no better place for it), and that's why it's overwritten.
Nonetheless, your workaround may even work forever with a bit of luck, but you know you are driving off road.


Offline danny

  • Tireless poster
  • ****
    • Posts: 281
    • View Profile
...wget...if you can share...
Sure, here is a no-frills version.
Code: [Select]
@echo off
:ONE
timeout /t 10 > nul
VER > nul
wget 127.0.0.1:80/favicon.ico --output-document=nul --quiet
IF %ERRORLEVEL% NEQ 0 GOTO TWO
GOTO ONE
:TWO
TASKKILL /IM hfs.exe /F
timeout /t 3
start "" "hfs.exe"
GOTO ONE
Assumptions:
batch file and wget in same folder as hfs.exe
HFS filename is hfs.exe (you can edit both)
port 80 (you can edit)


Windows 7, 8, 8+1, 10 can run it.  Both script and WGET are in the attachments.
...share the final working code you end [up] using...
Also attached is a deluxe/embellished version
WatchCat!
This has more patience for busy servers (so no unnecessary restarts), settable tries/timeouts, settings safeguard, and better display. . . including a little ascii-art staring cat at the top of the on-screen log.
« Last Edit: February 21, 2021, 08:12:21 AM by danny »


Offline bmartino1

  • Tireless poster
  • ****
    • Posts: 910
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
Sure, here it is.
Code: [Select]
@echo off
:ONE
timeout /t 10 > nul
VER > nul
wget 127.0.0.1:80/favicon.ico --output-document=nul --quiet
IF %ERRORLEVEL% NEQ 0 GOTO TWO
GOTO ONE
:TWO
TASKKILL /IM hfs.exe /F
timeout /t 3
start "" "hfs.exe"
GOTO ONE
Assumptions:
Watchdog and wget in same folder as hfs.exe
filename is hfs.exe (you can edit both)
port 80 (you can edit)

Windows 7, 8, 8+1, 10 can run it.  Watchdog and wget are in the attachment.
If all is well, it says nothing on-screen (next version may get a decoration). 
Test:  Exit hfs while watchdog is running, to see it start hfs in a few seconds.

http://gnuwin32.sourceforge.net/packages/wget.htm

Binary and depenancy download for Windows w get
Files I have snagged and share can be found on my google drive:

https://drive.google.com/drive/folders/1qb4INX2pzsjmMT06YEIQk9Nv5jMu33tC?usp=sharing


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 842
  • Status: On hiatus (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
Sure, here is a no-frills version.
Code: [Select]
@echo off
:ONE
timeout /t 10 > nul
VER > nul
wget 127.0.0.1:80/favicon.ico --output-document=nul --quiet
IF %ERRORLEVEL% NEQ 0 GOTO TWO
GOTO ONE
:TWO
TASKKILL /IM hfs.exe /F
timeout /t 3
start "" "hfs.exe"
GOTO ONE
Assumptions:
batch file and wget in same folder as hfs.exe
HFS filename is hfs.exe (you can edit both)
port 80 (you can edit)

Good! thanks for sharing...
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.