Похожие чаты

I'M in a situation where I have to execute a

bunch of unix commands "every second". things like device temperature, RX,TX packets, etc...

so my original solution was to use exec (https://www.npmjs.com/package/promisify-child-process)

and everything seems to be working just fine. but I don't know the right tools to benchmark my application. or whether is it ok to use child-process every second?

and I have another idea to create two Named Pipe, one with bash (to listen for keywords and execute the commands) and one with nodeJS (to receive the results).

so am I crazy for thinking that my original method is suspicus or the second idea is better ?

3 ответов

8 просмотров

You can probably obtain the data without spawning a new process

Пользователь-61933 Автор вопроса

so this is what I ended up doing. node spawns monitor.sh. then monitor.sh sends the result in a JSON format to IPC every second. so let me know what you think about this approach though I don't know any specific method for benchmarking node. the result from top command shows 3-7% CPU usage for monitor.sh and 1% for node and I'm aware that some of them can be used in node directly like /sys/class/net/"$iface"/statistics/"$path is a file, so no need for cat ... but this is just an overall view of what I'm trying to do ... so the script will change eventually https://gist.github.com/itshaadi/56d0c95c55de9e1114032a131c9adda2 @GingerPlusPlus @MKRhere

Похожие вопросы

Обсуждают сегодня

Карта сайта