upsforum

Well-Known Member
Jul 27, 2005
473
0
166
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?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
41
348
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