well , i use that script as a watchdog in my box (with has just 32 mb memory) which check every second if Polo binary is not running , it would start it. this works functionally right here.
but the problem is , it always use memory for sleep 1 command (since my box has a few memory and this watchdog is always running so it's really important for me to save memory of them ) as in top command always shows:
i need expert advice , how to change or improvw my script (esp those command) to would not use memory for sleep 1, ... or on the other words use least memory resources. would really appreciate any helps.
P.s : Linux 2.6.23.17_stm23_A21 #1 PREEMPT sh4 GNU/Linux
and pgrep , ... comes from busybox.
Best Regards.
As an alternate to sleep, have you considered using ping? Read the man page appropriate to your OS and define it to ping the local host twice. This usually takes one second, but do check it. Various OS have different options, so you might have one of the following:-
I'm not sure if that is lighter on memory, but it's worth a try.
well , i use that script as a watchdog in my box (with has just 32 mb memory) which check every second if Polo binary is not running , it would start it. this works functionally right here.
but the problem is , it always use memory for sleep 1 command (since my box has a few memory and this watchdog is always running so it's really important for me to save memory of them ) as in top command always shows:
i need expert advice , how to change or improvw my script (esp those command) to would not use memory for sleep 1, ... or on the other words use least memory resources. would really appreciate any helps.
P.s : Linux 2.6.23.17_stm23_A21 #1 PREEMPT sh4 GNU/Linux
and pgrep , ... comes from busybox.
Best Regards.
I have no experience with busybox (that I'm aware of) and haven't used linux very much during the past few years. That said, I think you may be overestimating the memory impact of running sleep.
All of sleep's code, the text segment of the executable, is already in ram since the shell running that script is the same exact binary. Since sleep, pgrep, pidof, date, echo, kill, sh, sleep, et al, are all instances of the busybox binary (only thing that differs is the name used to exec them), the kernel is able to run many instances of the binary using only a single copy of their code (the memory management subsystem maps that single copy of the text segment into each process' address space).
By the way, ping is also busybox, so that won't save anything (it will probably hurt a bit, as a ping is more complicated than a sleep).
Resorting to a non-busybox binary that isn't already in use will certainly be counterproductive. Its text segment is not shared with another extant process and so it will consume an amount of ram equal to its size (whereas a shared text segment consumes nearly nothing for each additional instance of that binary).
well , i use that script as a watchdog in my box (with has just 32 mb memory) which check every second if Polo binary is not running , it would start it. this works functionally right here.
but the problem is , it always use memory for sleep 1 command (since my box has a few memory and this watchdog is always running so it's really important for me to save memory of them ) as in top command always shows:
i need expert advice , how to change or improvw my script (esp those command) to would not use memory for sleep 1, ... or on the other words use least memory resources. would really appreciate any helps.
P.s : Linux 2.6.23.17_stm23_A21 #1 PREEMPT sh4 GNU/Linux
and pgrep , ... comes from busybox.
Best Regards.
Are you sure that 4.7% is right? Are you sure that percent doesn't count shared memory? That sounds inflated...
Greetings.
I've been wondering about this one for some time: Is there an alternative to sleep in bash?
The reason: I'd like to simply limit the amount of processor usage in continuous while : script scenarios without spawning endless sleep processes as well. After beating the manpages, I... (14 Replies)
How can I use the cp command to copy every file that I can find inside several folders
cp -R *test* folder
Supose there is
./122342343teste122343.txt
./bound/123teste1223453.txt
./feed/123teste1223453.txt
and i want the files 122342343teste122343.txt, bound/123teste1223453.txt... (12 Replies)
This is a very crude attempt in Bash at something that I needed but didn't seem to find in the 'sleep' command. However, I would like to be able to do it without the need for the temp file. Please go easy on me if this is already possible in some other way:
How many times have you used the... (5 Replies)
This perhaps does not belong in ths category; apologies, however, we have a heated debate going and your input will decide the result.
Should UNIX (HP, AIX, etc) be rebooted following a monthly cycle (Every month, or a qtr, etc.). We have some UX admins (grumps) who say they have seen a UX... (6 Replies)