commit message from python script
This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
#! /usr/bin/env python3
|
#! /usr/bin/env python3
|
||||||
|
|
||||||
import os, sys
|
import os, sys, subprocess
|
||||||
|
|
||||||
class nfs_server_conf:
|
class nfs_server_conf:
|
||||||
def __init__(self, nfs_srv_folders = ["/nfsroot/publicnfs","/nfsroot/datennfs"]) -> None:
|
def __init__(self, nfs_srv_folders = ["/nfsroot/publicnfs","/nfsroot/datennfs"]) -> None:
|
||||||
if not os.geteuid()==0:
|
if not os.geteuid()==0:
|
||||||
raise PermissionError("Sie sind kein Root")
|
raise PermissionError("Sie sind kein Root")
|
||||||
self.nfs_srv_folders = nfs_srv_folders
|
self.nfs_srv_folders = nfs_srv_folders
|
||||||
|
|
||||||
def create_serverfolder(self):
|
def create_serverfolder(self):
|
||||||
for srv_folder in self.nfs_srv_folders:
|
for srv_folder in self.nfs_srv_folders:
|
||||||
if os.path.exists(srv_folder):
|
if os.path.exists(srv_folder):
|
||||||
@@ -20,11 +21,22 @@ class nfs_server_conf:
|
|||||||
print("""[Unit]\nDescription=Mount nfs Server Share\n[Mount]\nWhat={srv_folder}\nWhere={srv_point}\nType=None\nOptions=bind\n[Install]\nWantedBy=multi-user.target""".format(
|
print("""[Unit]\nDescription=Mount nfs Server Share\n[Mount]\nWhat={srv_folder}\nWhere={srv_point}\nType=None\nOptions=bind\n[Install]\nWantedBy=multi-user.target""".format(
|
||||||
srv_folder=srv_folder,
|
srv_folder=srv_folder,
|
||||||
srv_point="/" + os.path.basename(srv_folder)), file=unit_file)
|
srv_point="/" + os.path.basename(srv_folder)), file=unit_file)
|
||||||
|
try:
|
||||||
|
mountfile = os.path.basename(srv_folder) + ".mount"
|
||||||
|
subprocess.run(['systemctl', 'daemon-reload'])
|
||||||
|
print(mountfile)
|
||||||
|
#subprocess.run('systemctl start ')
|
||||||
|
subprocess.Popen('systemctl start ' + mountfile, shell=True)
|
||||||
|
except SystemError:
|
||||||
|
raise "Service " + unit_file + " konnte nicht gestart werden"
|
||||||
|
|
||||||
|
|
||||||
def nfs_server_conf(self):
|
def nfs_server_conf(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def nfs_con_user(self):
|
def nfs_con_user(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def start_nfs_server(self):
|
def start_nfs_server(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user