Closed ThomasTJdev closed 5 years ago
The latest Firejail config allows a timeout
on Hours, from 1
to 99
Hours, it works,
maybe we can just delete all that code, and use firejail to restart every 1
Hour and do a wipe.
Like Reset at start when defined(demo)
, then Firejails restarts every 60 minutes, no while loop
needed.
Nim:
when defined(demo):
exec(db, sql"DELETE FROM blog")
createStandardData(db)
On config.cfg
:
[firejail]
timeout = 1
:slightly_smiling_face:
How does the firejail reset work?
nimwc
or nimwc_main
which is reset?noMnt
, would the reset increase the risk for race conditions? nimwc_main
nimwc_main
is stopped by Firejail, then nimwc
starts it again, then cycle repeats.
Can be tested on Bash terminal like:
firejail --timeout=00:00:05 sleep 9
Will stop on 5 seconds instead of 9. :slightly_smiling_face:
Testing in progress - 1 hour left ;) . When we integrate firejail more into NimWC, I think we should move the used config's to top and add comments. E.g.:
timeout=0 # Will kill program after n-hour
noX=true # If you are running headless, set it to false
noMnt=true # Deny access to e.g. /mnt
noDvd=true
noSound=true
noAutoPulse=true
no3d=true
noVideo=true
...
The config is "position agnostic", so yeah you can move them around freely, as long as they are under the same section, it just works. :+1:
Ok if we comment and move timeout to top in config.
The
resetDB()
is missing a loop which means, that the DB is only reset 1 time. Awhile loop
is needed:https://github.com/ThomasTJdev/nim_websitecreator/blob/8e9a96a431b8baa01d179276d14eb38ba14354f9/nimwcpkg/nimwc_main.nim#L444-L454