コード例 #1
0
    def status(self):
        out, err = exec("sudo pgrep -lf nginx")
        # print(out, err)
        if len(out) == 0:
            return STATUS_NOT_RUNNING
        for l in out:
            if "{}/etc/nginx/nginx.conf".format(SERVER_ROOT) in l:
                return STATUS_OK

        return STATUS_BAD_RUNNING
コード例 #2
0
    def status(self):
        o, _ = exec('sudo brew services list')
        
        for l in o:
            if 'mysql' in l:
                if 'started' in l:
                    return STATUS_OK
                else:
                    return STATUS_NOT_RUNNING

        return STATUS_NOT_RUNNING
コード例 #3
0
    def status(self):
        out, err = exec("sudo pgrep -lf php-fpm")
        ok_line = "php-fpm -y {}/etc/php/7.0/php-fpm.conf -c {}/etc/php/7.0/php.ini".format(SERVER_ROOT,SERVER_ROOT)

        if len(out) == 0:
            return STATUS_NOT_RUNNING
        for l in out:
            if ok_line in l:
                return STATUS_OK

        return STATUS_BAD_RUNNING
コード例 #4
0
ファイル: main.py プロジェクト: Kvis-Dev/mamp
def check_installs():
    if not os.geteuid() == 0:
        print(
            "need sudo to run this script, please, rerun with:\nsudo python3 {}"
            .format(sys.argv[0]))
        sys.exit(1)

    checks, _ = exec("which brew".format(USER))
    if len(checks) == 0:
        print(
            'Can not proceed without brew, visit https://brew.sh/ to install brew'
        )
        sys.exit(2)

    checks, _ = exec("sudo -u {} brew list".format(USER))

    if 'nginx' not in checks:
        print('Can not proceed without nginx, run:\nbrew install nginx')
        sys.exit(3)

    if 'php70' not in checks:
        print('Can not proceed without php70, run:\nbrew install php70')
        sys.exit(3)
コード例 #5
0
 def start(self):
     nginx_start_cmd = "sudo nginx -c {}/etc/nginx/nginx.conf".format(SERVER_ROOT)
     self.append_etc_hosts()
     exec(nginx_start_cmd)
コード例 #6
0
 def stop(self):
     exec('sudo nginx -s stop; sudo killall nginx')
コード例 #7
0
 def get_is_installed(self):
     out, _ = exec('readlink `which apachectl`')
コード例 #8
0
 def stop(self):
     exec("sudo apachectl stop")
コード例 #9
0
 def start(self):
     exec("sudo apachectl start -f /usr/local/apache2/conf/httpd.conf")
コード例 #10
0
    def status(self):
        status, _= exec('sudo pgrep -lf apache2')

        for l in status:
            if 'httpd -k start' in l:
                return STATUS_OK
コード例 #11
0
 def stop(self):
     exec('sudo brew services stop mysql')
コード例 #12
0
 def start(self):
     exec('sudo brew services start mysql')
コード例 #13
0
 def stop(self):
     exec('sudo killall php-fpm')
コード例 #14
0
 def start(self):
     php_70_start_command = "sudo /usr/local/opt/php70/sbin/php-fpm -y {}/etc/php/7.0/php-fpm.conf -c {}/etc/php/7.0/php.ini".format(SERVER_ROOT, SERVER_ROOT)
     exec(php_70_start_command)
コード例 #15
0
ファイル: config.py プロジェクト: Kvis-Dev/mamp
import os
from helpers import exec

ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
HOME = exec("cd ~ && pwd")[0][0]
USER = HOME.split('/')[-1]
SERVER_ROOT = "{}/web".format(HOME)