Is there a way to make the clean_mem command perform automatically?

Is there a way to make the clean_mem command perform automatically?
Say in intervals of every fiveteen minutes, or prefferable maybe, by somehow letting the server do it itself when a certain stage has been reached, where clean_mem or however it goes internally would be applied as needed by the system?

Maybe set up a cron job?

crontab -e

minute hour day-of-month month day-of-week command
For all the numbers you can use lists eg, 5,34,55 in the first field will mean run at 5 past 34 past and 55 past what ever hour is defined.

You can also use intervals, they are defined like this: */20 this example means every 20th and if in the minutes column this will be equivalent to 0,20,40
So to run a command every monday at 5:30 in afternoon:
30 17 * * 1 /usr/bin/somedirectory/somecommand

or every 15 minutes
*/15 * * * * /usr/bin/somedirectory/somecommand

or pr user
*/15 * * * * root /usr/bin/somedirectory/somecommand

Note that the day-of-week goes from 0-6 where 0 is sunday.

You can see the contents of the user crontab with crontab -l.

1 Like

or every 15 minutes
*/15 * * * * /usr/bin/somedirectory/somecommand

Well I assume crontab is already installed with the quickbox.io installation then?
The command, half of it I understand the other half leaves me puzzled. But for me most importantly
, it just has to work.

So the text quoted would suite my needs however how do I find the folder where the command of clean_mem in this case is located, and how do I boot the sequence.
Just by typing: “sudo crontab -e” && "/15 * * * * /usr/bin//clean_mem

?

Thanks for the quick reply btw :slight_smile:

Also but wondering if this is for a different thread. If it is tell me please.
Is there something I could configure differently where the memory issue wouldn’t arise or just auto clean that cache somehow?
It seems weird to me that one would have to manually put in the command wheter from an apt script or otherwise.

Just because bars topping doesn´t mean anything bad - its´just how linux runs as far as I remember. It has also been mentioned else where :slight_smile:

1 Like

"So the text quoted would suite my needs however how do I find the folder where the command of clean_mem in this case is located, and how do I boot the sequence.
Just by typing: “sudo crontab -e” && “/15 * * * * /usr/bin//clean_mem”

Is this answered elsewhere or was that not what you meant?

Why would you want to clear the cache mem so often? Performance wise you wont win anything from it. You’ll only slow your server down

4 Likes

This exactly. I would not advise you creating a cron to clean your cached memory that often. This is merely a courtesy function that has been included if someone really needs to clear out their cached mem, for whatever reason. pay attention to Real Memory usage and not cached or physical.

You can find an explanation here and here for more info… I will also create a FAQ in this regard as a lot of people seem confused as to what this is exactly.

2 Likes