[zorg] r312366 - Task to rotate the LNT log.
Chris Matthews via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 1 14:02:09 PDT 2017
Author: cmatthews
Date: Fri Sep 1 14:02:09 2017
New Revision: 312366
URL: http://llvm.org/viewvc/llvm-project?rev=312366&view=rev
Log:
Task to rotate the LNT log.
Modified:
zorg/trunk/llvm-lnt/fabfile.py
Modified: zorg/trunk/llvm-lnt/fabfile.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvm-lnt/fabfile.py?rev=312366&r1=312365&r2=312366&view=diff
==============================================================================
--- zorg/trunk/llvm-lnt/fabfile.py (original)
+++ zorg/trunk/llvm-lnt/fabfile.py Fri Sep 1 14:02:09 2017
@@ -6,6 +6,7 @@
import os
from os.path import expanduser
+import re
from fabric.api import env, cd, task, run, put
from fabric.api import sudo
from fabric.context_managers import hide
@@ -56,7 +57,7 @@ def update():
put(here + "/kill_zombies.py", "/tmp/kill_zombies.py")
sudo("mv /tmp/kill_zombies.py /etc/cron.hourly/kill_zombies")
sudo("chmod +x /etc/cron.hourly/kill_zombies")
-
+ rotate_log()
service_restart()
@@ -79,12 +80,23 @@ def new_log():
for l in new_lines - lines:
print ' '.join(l.split()[2:]),
+
@task
def ps():
sudo('ps auxxxf | grep gunicorn')
@task
+def rotate_log():
+ """Rotate the LNT log."""
+ sudo('rm -rf /srv/lnt/install/gunicorn.error.log')
+ out = sudo('ps auxxxf | grep "gunicorn: master"')
+ pid = re.search(r'lnt\s+(?P<pid>\d+)\s+', out).groupdict()['pid']
+ print pid
+ sudo('kill -USR1 ' + pid)
+
+
+ at task
def df():
sudo('df -h')
More information about the llvm-commits
mailing list