Skip to content

Commit

Permalink
Task to rotate the LNT log.
Browse files Browse the repository at this point in the history
llvm-svn: 312366
  • Loading branch information
Chris Matthews committed Sep 1, 2017
1 parent 6ad3686 commit f491d9f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion llvm-lnt/fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()


Expand All @@ -79,11 +80,22 @@ 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)


@task
def df():
sudo('df -h')
Expand Down

0 comments on commit f491d9f

Please sign in to comment.