Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if __name__ == "__main__":
- from subprocess import check_output
- status = 4
- textout = "mysql: "
- active = check_output(["systemctl", "is-active", "mysql.service"]).rstrip()
- enabled = check_output(["systemctl", "is-enabled", "mysql.service"]).rstrip()
- if active == "active":
- textout += "active"
- if enabled == "enabled":
- textout += " and enabled"
- status = 0
- elif enabled == "disabled":
- textout += " BUT DISABLED"
- status = 2
- else:
- textout += " but unclear if enabled"
- status = 3
- elif active == "inactive":
- textout += "INACTIVE"
- if enabled == "enabled":
- textout += " but enabled"
- status = 1
- elif enabled == "disabled":
- textout += " AND DISABLED"
- status = 2
- else:
- textout += " but unclear if enabled"
- status = 2
- else:
- textout += "UNCLEAR IF ACTIVE"
- if enabled == "enabled":
- textout += " but enabled"
- status = 3
- elif enabled == "disabled":
- textout += " AND DISABLED"
- status = 2
- else:
- textout += " AND UNCLEAR IF ENABLED"
- status = 2
- print textout
- import sys
- sys.exit(status)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement