Email troubles

Discussion in 'Installation/Configuration' started by wshakes, Mar 5, 2017.

  1. wshakes

    wshakes Member

  2. wshakes

    wshakes Member

    Hey brother, please tell me how to set that cron to "clear the ram" you speak of. I'm rather new here. I'm going to need that cron. @Cris Kolkman
     
  3. Cris Kolkman

    Cris Kolkman Member

    I created the file cacheclear.sh in /home

    root@***:~# ls -l /home/
    total 8
    -rwxr-xr-x 1 root root 64 Nov 30 11:33 cacheclear.sh
    And made it executable.

    The content of cacheclear.sh:
    #!/bin/sh
    sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"

    And put this in crontab -e
    0 * * * * /home/cacheclear.sh


    Don't know if it's usefull on a 1GB ram server since the processes running on the server will use all the ram and not cache much.

    Code:
    root@***:~# free -m
                 total       used       free     shared    buffers     cached
    Mem:          3965       1582       2383        108         19        493
    -/+ buffers/cache:       1069       2896
    Swap:         6257          0       6257
     
  4. wshakes

    wshakes Member

    It's worth a try. I am sorry, but this is my first week of command line linux system administration, so... baby steps. Okay, I have a file open with nano cacheclear.sh, now do I change the root@** part of the script to mydomain.com ? And how do I "make it executable?"
     
  5. Cris Kolkman

    Cris Kolkman Member

    No you don't have to do anything with the root@***

    Just follow these steps:

    nano /home/cacheclear.sh

    Put this in the file:
    #!/bin/sh
    sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"

    Save and close the file.

    chmod +x /home/cacheclear.sh

    And then add this line to crontab -e
    0 * * * * /home/cacheclear.sh
     
  6. wshakes

    wshakes Member

    Oh, Okay I was way off.
    Got it.
    Does it matter if I add it to the bottom or the top of crontab -e?

    So, Here is my crontab -e
    Code:
    * * * * * /usr/local/ispconfig/server/server.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    * * * * * /usr/local/ispconfig/server/cron.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    0 * * * * /home/cacheclear.sh
    
    and here is my cacheclear.sh (located in home folder)
    Code:
    #!/bin/sh
    sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"
    
    How do I test to make sure it's working?
     
  7. wshakes

    wshakes Member

    sudo sh cacheclear.sh
    sh: /proc/sys/vm/drop_caches: Permission denied
     
  8. Cris Kolkman

    Cris Kolkman Member

    What does this command tell you:

    ls -l /proc/sys/vm/drop_caches
     
  9. wshakes

    wshakes Member

    -rw-r--r-- 1 root root 0 Mar 5 03:47 /proc/sys/vm/drop_caches
     
  10. Cris Kolkman

    Cris Kolkman Member

    You are running that command as user root or different user?
     
  11. wshakes

    wshakes Member

  12. wshakes

    wshakes Member

    I actually have 2 other VPS with 2.5 GB RAM, I may have to start all over, over on those ones :D I must ask, is it bad, to use all my ram around 90-100% ? My VSWAP is still in the green. Will my host get mad?
     
  13. Cris Kolkman

    Cris Kolkman Member

    Like they say it's because of the OpenVz server and you are simply not allowed to clear the server ram cache.
    My server is also a virtual server but I'm allowed to run the command.
    There seems to be no other way to clear the cache then that command, like they say in the replies.
     
  14. wshakes

    wshakes Member

    Got it. We tried. What do you think about my other questions right after that? And from there, I will leave you alone. Thank you for all of your help.
     
  15. Cris Kolkman

    Cris Kolkman Member

    z
    I can't imagine they will get angry if you use all your ram.
    Using the 2.5GB server is probably better but don't forget that you probably delay the problem because it will keep using ram till it's at 100% (my experience though).
    If I don't run the cacheclear.sh on my 4GB server it will also go to 100% because of the cache.
     
  16. wshakes

    wshakes Member

    May I ask approximately how long until it reaches 100% on your 4GB server? And how often do you run a cache clear? Is this everyone's experience? Is this a debian issue, or ISPconfig issue? And is this standard practice for ISPCONFIG users? This seems like a huge problem to me, is it not? My only solution is to make my server have to restart itself every so often? Is it a memory leak, a misconfiguration, or another issue?

    Looking for solutions...
    Thanks again. @florian030 @Cris Kolkman
     
  17. Cris Kolkman

    Cris Kolkman Member

    @wshakes can't really remember how long it takes before mine goes to 100%, but running the cronjob for clearing the cache every hour so the cache stays clear :)
    Don't think you can really call this a "problem" because using ram cache is quite normal for every machine, only on machines with low ram it's being an issue because it stops working properly.
     
  18. wshakes

    wshakes Member

    I thought the whole point of debian was you don't have to restart your server for only about once every 3 years ;) I just don't get it!
     
  19. wshakes

    wshakes Member

    Ok, for anyone who is a newbie like me who reads this someday,
    I found out some things.
    So clearing cache appears unimportant. On top of that, this website helped me to understand what is really going on, http://www.linuxatemyram.com/
    And https://www.howtoforge.com/community/threads/how-much-of-ram-consumed-ispconfig-3.58136/ This link explains that Ispconfig actually uses very little ram at all.
    Thank you all to your help. I am going to let my server run hard without a restart for a few days at least and see what happens.
     
  20. Cris Kolkman

    Cris Kolkman Member

    I don't really know about that, what I do know is that running a 1GB ram server with so many functions is probably not the best solution.
     

Share This Page