Question
How to recreate log files hard link structure?
Answer
For one domain
-
Log in to Plesk server using SSH.
-
Find the system user for the affected domain:
# plesk db “select d.name,s.login from domains d join hosting h on d.id = h.dom_id join sys_users s on h.sys_user_id=s.id where d.name=’example.com’;”
+————-+———+
| name    | login  |
+————-+———+
| example.com | jdoe  |
+————-+———+ -
Recreate the structure:
# plesk sbin relink-vhost-logs –domain-name example.com –sys-user-login jdoe –create
For all domains
-
Log in to Plesk server using SSH.
-
Move all files from
/var/www/vhosts/*/logs/
directories:# mkdir /root/temp
# plesk db -Ne ‘select name from domains where htype=”vrt_hst”‘ | xargs -I ‘{}’ mkdir -p /root/temp/'{}’
# for i in `plesk db -Ne ‘select name from domains where htype=”vrt_hst”‘` ; do mv /var/www/vhosts/$i/logs/* /root/temp/$i/; done -
Use the following command, which will re-create hardlink structure for all the domains with physical hosting enabled:
# plesk db -Nse “select name from domains where htype=’vrt_hst'” | while read dom; do export sys=/var/www/vhosts/system/$dom/logs/; ls -1 $sys | while read fil; do ln -P $sys/$fil /var/www/vhosts/$dom/logs/; done; done