The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

enable archive logs in mass

Discussion in 'General Discussion' started by upsforum, Aug 24, 2011.

  1. upsforum

    upsforum Well-Known Member

    Joined:
    Jul 27, 2005
    Messages:
    446
    Likes Received:
    0
    Trophy Points:
    16
    Hi,

    I must enable this option in cpanel:

    Archive logs in your home directory at the end of each stats run

    but I have 100 websites on my vps is not possible enable this option with unique command/procedure?
     
  2. upsforum

    upsforum Well-Known Member

    Joined:
    Jul 27, 2005
    Messages:
    446
    Likes Received:
    0
    Trophy Points:
    16
    I need enable all logs archive in mass on all accounts, but I dont match this option or command
     
  3. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    When you choose to archive the logs, it puts a file at /home/username/.cpanel-logs location with the following content in it:

    Code:
    archive-logs=1
    You could run these commands to create that file and put those contents into it for each account, then chown the file to the user:

    Code:
    for i in `cat /etc/trueuserdomains | cut -d: -d' ' -f2-` ;do echo "archive-logs=1" > /home/$i/.cpanel-logs ;done
    for i in `cat /etc/trueuserdomains | cut -d: -d' ' -f2-` ;do chown $i:$i /home/$i/.cpanel-logs && chmod 600 /home/$i/.cpanel-logs ;done
    Of note, this will replace anything they already have in the file. If you also want the option "Remove the previous month's archived logs from your home directory at the end of each month" to be set, this would be the following entry put into that file:

    Code:
    remove-old-archived-logs=1
    This would then be the following command:

    Code:
    for i in `cat /etc/trueuserdomains | cut -d: -d' ' -f2-` ;do echo "remove-old-archived-logs=1" >> /home/$i/.cpanel-logs ;done
     
Loading...

Share This Page