commit message from python script
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
import os, sys
|
||||
import os, sys, subprocess
|
||||
|
||||
class nfs_server_conf:
|
||||
def __init__(self, nfs_srv_folders = ["/nfsroot/publicnfs","/nfsroot/datennfs"]) -> None:
|
||||
if not os.geteuid()==0:
|
||||
raise PermissionError("Sie sind kein Root")
|
||||
self.nfs_srv_folders = nfs_srv_folders
|
||||
|
||||
def create_serverfolder(self):
|
||||
for srv_folder in self.nfs_srv_folders:
|
||||
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(
|
||||
srv_folder=srv_folder,
|
||||
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):
|
||||
pass
|
||||
|
||||
def nfs_con_user(self):
|
||||
pass
|
||||
|
||||
def start_nfs_server(self):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user