Skip to content

Commit f491d9f

Browse files
author
Chris Matthews
committed
Task to rotate the LNT log.
llvm-svn: 312366
1 parent 6ad3686 commit f491d9f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

llvm-lnt/fabfile.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import os
77
from os.path import expanduser
88

9+
import re
910
from fabric.api import env, cd, task, run, put
1011
from fabric.api import sudo
1112
from fabric.context_managers import hide
@@ -56,7 +57,7 @@ def update():
5657
put(here + "/kill_zombies.py", "/tmp/kill_zombies.py")
5758
sudo("mv /tmp/kill_zombies.py /etc/cron.hourly/kill_zombies")
5859
sudo("chmod +x /etc/cron.hourly/kill_zombies")
59-
60+
rotate_log()
6061
service_restart()
6162

6263

@@ -79,11 +80,22 @@ def new_log():
7980
for l in new_lines - lines:
8081
print ' '.join(l.split()[2:]),
8182

83+
8284
@task
8385
def ps():
8486
sudo('ps auxxxf | grep gunicorn')
8587

8688

89+
@task
90+
def rotate_log():
91+
"""Rotate the LNT log."""
92+
sudo('rm -rf /srv/lnt/install/gunicorn.error.log')
93+
out = sudo('ps auxxxf | grep "gunicorn: master"')
94+
pid = re.search(r'lnt\s+(?P<pid>\d+)\s+', out).groupdict()['pid']
95+
print pid
96+
sudo('kill -USR1 ' + pid)
97+
98+
8799
@task
88100
def df():
89101
sudo('df -h')

0 commit comments

Comments
 (0)