Created
November 3, 2021 00:06
-
-
Save tridnguyen97/bd593b781ac76b635a02c8772fb5a230 to your computer and use it in GitHub Desktop.
download plesk obsidian into ubuntu 20.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| import subprocess | |
| import sys | |
| import inspect | |
| def run_and_printchar(args): | |
| try: | |
| pipe = subprocess.Popen(args, bufsize = 0, | |
| shell = False, | |
| stdout = None, # no redirection, child use parent's stdout | |
| stderr = subprocess.PIPE) # redirection stderr, create a new pipe, from which later we will read | |
| except Exception as e: | |
| #inspect.stack()[1][3] will get caller function name | |
| logging.error(inspect.stack()[1][3] + ' error: ' + str(e)) | |
| return False | |
| while 1: | |
| #use read(1), can get wget progress bar like output | |
| s = pipe.stderr.read(1) | |
| if s: | |
| sys.stdout.write(s) | |
| if pipe.returncode is None: | |
| code = pipe.poll() | |
| else: | |
| break | |
| if not 0 == pipe.returncode: | |
| return False | |
| return True | |
| run_and_printchar(['wget', 'https://autoinstall.plesk.com/plesk-installer']) | |
| command = 'chmod u+x ./plesk-installer' | |
| process = subprocess.Popen(command.split(), stdout=subprocess.PIPE) | |
| output, error = process.communicate() | |
| subprocess.call(['sh', './plesk-installer', '--all-version']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment