Automatic Reboot

Discussion in 'General' started by Telco, Dec 27, 2007.

  1. Telco

    Joined:
    Oct 4, 2007
    Messages:
    275
    Likes Received:
    0
    Is there a way to do an automatic reboot. I am having memory issues and a reboot fixes it temporally. so I was wondering if there is a way to set the server to reboot every night.
     
  2. moyses

    Joined:
    Sep 26, 2007
    Messages:
    38
    Likes Received:
    0
    As root edit your crontab file and add a line with the
    shutdown -r now command indicating the time you want the reboot.

    Regards!
     
  3. Telco

    Joined:
    Oct 4, 2007
    Messages:
    275
    Likes Received:
    0
    so would that command look like

    shutdown -r 0200

    (0200) meaning 2am
     
  4. zeus

    Joined:
    Oct 25, 2007
    Messages:
    60
    Likes Received:
    0
    I had the same problem with memory resources. I have an ADM 64 Opteron with 1GB RAM. After 1 week the memory is 95% and if it reaches 99% then i can not make or receive calls. The solution i have found is:

    Make a cron job with this commands

    echo 1 > /proc/sys/vm/drop_caches
    echo 2 > /proc/sys/vm/drop_caches
    echo 3 > /proc/sys/vm/drop_caches

    The cron run this commands once a week and now my system does not need a reboot. Approximately i now have 48 days uptime.

    Hope this helps.
     
  5. cowboy47

    Joined:
    Jun 14, 2007
    Messages:
    276
    Likes Received:
    0
    Could you clarrify this? You have to drop cache 3 times , once a week?

    If you have build a manual cron script, could you share it?

    If you set up the cron schedule, did you do it through Webmin?
     
  6. zeus

    Joined:
    Oct 25, 2007
    Messages:
    60
    Likes Received:
    0
    Sorry about that, my mistake. So let's clarrify this.

    To free pagecache:

    echo 1 > /proc/sys/vm/drop_caches

    To free dentries and inodes:

    echo 2 > /proc/sys/vm/drop_caches

    To free pagecache, dentries and inodes:

    echo 3 > /proc/sys/vm/drop_caches

    You don't have to run all of them, just the option that you want to clean. I use the echo 3.
    I did it through webmin but you can add it manually in /var/spool/cron/root.
    if you want to do it manually just add to the above file one of the below:

    @weekly echo 1 > /proc/sys/vm/drop_caches #memory clean pagecache
    @weekly echo 2 > /proc/sys/vm/drop_caches #memory clean dentries and inodes
    @weekly echo 3 > /proc/sys/vm/drop_caches #memory clean pagecache, dentries and inodes

    Let me know if this work for you.
     
  7. cowboy47

    Joined:
    Jun 14, 2007
    Messages:
    276
    Likes Received:
    0
    Thanks, that helps a lot.

    C
     

Share This Page