adding the service files and and a script to gather them

This commit is contained in:
2025-10-21 21:02:17 -05:00
parent 3d1d8a12d5
commit 283acd26c4
12 changed files with 169 additions and 0 deletions

21
copy_systemd_files.py Normal file
View 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')