1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Clearing old servers VAR space

Discussion in 'Site & Server Administration' started by Daniel Myers, Jan 28, 2016.

  1. #1
    I have an old server that was set up with only 10 GB of VAR space. The server VAR space is full. I have been searching around to see the best way to clear out this space. I did find an article on CSM (CPanel Server Management) that had a good set of instructions. I'm jut curious if emptying the mail queue is such a good idea.
     
    Daniel Myers, Jan 28, 2016 IP
  2. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #2
    Daniel,

    Only if you have a backup of it. You can run 'yum clean all' to clear out the yum cache, and rm -vf /var/log/*.{1,2,3,4,gz}* to remove old logfiles. You might also check the size of MySQL with du -shc /var/lib/mysql and see if there's maybe some tables that are able to be truncated like modsec or eximstats.
     
    zacharooni, Feb 5, 2016 IP
    th.sigit likes this.
  3. Localnode

    Localnode Active Member

    Messages:
    33
    Likes Received:
    7
    Best Answers:
    1
    Trophy Points:
    65
    #3
    I'd advise against emptying the mail queue.
    Have a look at this article. It helps in clearing logs.
    https://documentation.cpanel.net/display/CKB/How+to+Manage+your+Hard+Drive+Space

    (Can't link it, probably due to post count).
     
    Localnode, Feb 5, 2016 IP
  4. sahabcse

    sahabcse Well-Known Member

    Messages:
    272
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    140
    #4
    This bash script might be helpful to combine said above and run all the operations to free up the disk space:

    # Delete error_log files larger then 10MB
    find /home/*/public_html/ -type f -name “error_log” -size +10M -delete
    # Delete Backups stored in /home/user/ folder
    for user in `/bin/ls -A /var/cpanel/users` ; do rm -fv /home/$user/backup-*$user.tar.gz ; done
    # Delete cPanel File Manager temp files
    rm -fv /home/*/tmp/Cpanel_*
    # Remove pure-ftp partials
    locate .pureftpd-upload | xargs rm -fv

    Save these commands into the file under /root/DiskCleanupScripts.sh

    and add cron job in /var/spool/cron/root file:

    40 4 */2 * * /root/DiskCleanupScripts.sh

    So this will run every 2-nd day at 4:40am.
     
    sahabcse, Feb 6, 2016 IP