I'm trying to run node.js as a daemon using runit, here’s a run script with a limit of 250 MB of memory:

#!/bin/shcd /home/artemexec 2>&1exec chpst -u artem -m 262144000 node test.js >> production.log 2>&1 

So it works, the top utility writes that the node weighs 9 mb, and if I specify a 50 mb limit, then the launch does not occur, timeout is displayed: down: artem: 1s, normally up, want up

I do not understand what the catch is, because the node weighs only 9 mb in memory, and it does not start with a limit of 50 mb.

    2 answers 2

    Honestly, I do not know what it is)

    Maybe it will help to understand: use runit instead of Init and output logs to a file .

      most likely, more memory is required during initialization than after this process is completed.