adding the service files and and a script to gather them
This commit is contained in:
21
copy_systemd_files.py
Normal file
21
copy_systemd_files.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
if __name__ == "__main__":
|
||||
source_dir = r'/etc/systemd/system'
|
||||
info_file = 'restart_services.sh'
|
||||
items = os.listdir(source_dir)
|
||||
print(items)
|
||||
with open(info_file, 'r') as file:
|
||||
for line in file:
|
||||
filename = line.strip().split()[-1]
|
||||
print(filename)
|
||||
if filename != 'nginx':
|
||||
socket_file = os.path.join(source_dir,f'{filename}.socket')
|
||||
service_file = os.path.join(source_dir,f'{filename}.service')
|
||||
if os.path.isfile(socket_file):
|
||||
shutil.copyfile(socket_file, f'./systemd/{filename}.socket')
|
||||
if os.path.isfile(service_file):
|
||||
shutil.copyfile(service_file,f'./systemd/{filename}.service')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user