• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

openhealthcare / elcid-rfh / 3890

pending completion
3890

Pull #881

travis-ci

web-flow
Make the disk checker part of the automated deployment
Pull Request #881: Make the disk checker part of the automated deployment

44 of 177 branches covered (24.86%)

15 of 15 new or added lines in 1 file covered. (100.0%)

2623 of 3306 relevant lines covered (79.34%)

1.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/elcid/management/commands/check_disk_space.py
1
"""
2
Management command to check disk space on a server.
3
"""
4
import subprocess
×
5

6
from django.conf import settings
×
7
from django.core.mail import send_mail
×
8
from django.core.management.base import BaseCommand
×
9

10

11
def raise_the_alarm():
×
12
    send_mail(
×
13
        "RFH Live Disk Space Alert: Action Required",
14
        "Routine system check on Elcid RFH has detected a volume with > 90% disk usage. Please log in and investigate.",
15
        settings.DEFAULT_FROM_EMAIL,
16
        [i[1] for i in settings.ADMINS]
17
    )
18

19

20
class Command(BaseCommand):
×
21
    def handle(self, *a, **k):
×
22
        p1 = subprocess.Popen(["df", "-h"], stdout=subprocess.PIPE)
×
23
        p2 = subprocess.Popen(["awk", "{print $5}"], stdin=p1.stdout, stdout=subprocess.PIPE)
×
24
        p3 = subprocess.Popen(["egrep", "9[0-9]%"], stdin=p2.stdout, stdout=subprocess.PIPE)
×
25
        out, er = p3.communicate()
×
26
        if out:
×
27
            raise_the_alarm()
×
28
        return
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc