Added support for call make_task for other scripts
This commit is contained in:
parent
e1710bf434
commit
c56366923f
6 changed files with 108 additions and 11 deletions
|
|
@ -15,6 +15,7 @@ if pyv[0]!='3':
|
|||
parser = argparse.ArgumentParser(description='Script for create a new mariadb server.')
|
||||
|
||||
parser.add_argument('--password', help='The password of the new server', required=True)
|
||||
parser.add_argument('--ip', help='The IP where mariadb petitions are listened, if not, only listen in localhost')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
|
@ -32,10 +33,22 @@ if linux_distro=='debian':
|
|||
if subprocess.call("sudo DEBIAN_FRONTEND=noninteractive apt-get -y --force-yes install mariadb-server", shell=True) > 0:
|
||||
print('Error, cannot install MariaDB...')
|
||||
sys.exit(1)
|
||||
elif linux_distro=='arch':
|
||||
if call("sudo pacman -S --noconfirm mariadb", shell=True) > 0:
|
||||
|
||||
# sed -i 's/old-text/new-text/g' input.txt
|
||||
|
||||
# /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||
# bind-address = 127.0.0.1
|
||||
|
||||
if args.ip:
|
||||
if subprocess.call("sudo sed -i 's/bind-address = 127.0.0.1/bind-address = {}/g' /etc/mysql/mariadb.conf.d/50-server.cnf".format(args.ip), shell=True) > 0:
|
||||
print('Error, cannot install MariaDB...')
|
||||
exit(1)
|
||||
sys.exit(1)
|
||||
|
||||
elif linux_distro=='arch':
|
||||
|
||||
if call("sudo pacman -S --noconfirm mariadb", shell=True) > 0:
|
||||
print('Error, cannot install MariaDB...')
|
||||
exit(1)
|
||||
|
||||
print('Setting the password...')
|
||||
|
||||
|
|
@ -45,6 +58,11 @@ if subprocess.call("sudo mysqladmin -u root password "+args.password, shell=Tru
|
|||
else:
|
||||
print('Mariadb installed successfully')
|
||||
sys.exit(0)
|
||||
|
||||
if subprocess.call("sudo systemctl restart mariadb", shell=True) > 0:
|
||||
print('Error, cannot restart mariadb')
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
"""
|
||||
if subprocess.call("sudo echo 'mariadb-server mariadb-server/root_password_again password "+args.password+"' | sudo debconf-set-selections", shell=True) > 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue