I'm trying to read log with tail -f with my fabric script:
@task
def log(service):
sudo("tail -n 50 -f " + service)
With -f option you have to manually terminate tail by Ctrl-C. It doesn't work properly with fabric version (fab log:), Ctrl-C doesn't terminate remote command:
<remote-host>$ ps aux | grep tail
root 27314 0.0 0.0 33380 1744 ? Ss 10:49 0:00 sudo -S -p sudo password: /bin/bash -l -c tail -n 50 -f /var/log/karma/gunicorn_gevent_error.log
root 27315 0.0 0.0 5592 584 ? S 10:49 0:00 tail -n 50 -f /var/log/karma/gunicorn_gevent_error.log
... <they stack> ...
mezhenin 27337 0.0 0.0 7788 864 pts/8 R+ 10:49 0:00 grep tail
What is correct way for doing things above?