Skip to content

Commit bb987da

Browse files
authored
Merge pull request #14 from systemswatch/systemd-config-changes-1
Changes to SystemD
2 parents b932756 + 668e625 commit bb987da

File tree

6 files changed

+16
-21
lines changed

6 files changed

+16
-21
lines changed

.pylintrc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[MAIN]
22

33
disable=
4-
C0114, # missing-module-docstring
4+
C0114, # missing-module-docstring
55
C0116, # missing-function-docstring
66
W0141, # In Python 2, input() can be dangerous because it evaluates Python code, thus should be blacklisted for production code. In Python 3, input() behaves like Python 2's raw_input() which can only return a string.
7-
R1260, # Menu complexity is not avoidable at this time or worth fixing for this use case
8-
R0801 # By nature there will be some duplicate code because of the dynamic config generation and autonomy of configs
7+
R1260, # Menu complexity is not avoidable at this time or worth fixing for this use case.
8+
R0801, # By nature there will be some duplicate code because of the dynamic config generation and autonomy of configs.
9+
C0413 # Unnecessary error on import position because we are trying to prevent pycache with sys.dont_write_bytecode True
910

1011
# Specify a configuration file.
1112
#rcfile=

process_watch.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

3-
import os
4-
import logging
5-
import importlib
63
import sys
74
sys.dont_write_bytecode = True
85
sys.path.append('watch_list')
6+
import os
7+
import logging
8+
import importlib
99

1010
# Logging Configuration
1111
os.makedirs(os.getcwd() + "/logs", exist_ok=True)
@@ -33,4 +33,4 @@ def import_watch_list():
3333
file.write(str(e) + "\n")
3434
raise sys.exit(1)
3535

36-
import_watch_list()
36+
import_watch_list()

systemd/process_watch.service

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ After=network.target
66
User=root
77
Group=root
88
WorkingDirectory=/usr/local/process_watch
9-
Environment="PATH=/usr/local/process_watch_env/bin"
10-
ExecStart=/usr/local/process_watch_env/bin/python process_watch.py
9+
ExecStart=/usr/bin/python3 /usr/local/process_watch/process_watch.py
1110

1211
[Install]
1312
WantedBy=multi-user.target

tools/config_tool.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

3-
import os
43
import sys
4+
sys.dont_write_bytecode = True
5+
import os
56
from general_process_profiler import general_process_profiler
67
from memory_process_profiler import memory_process_profiler
7-
sys.dont_write_bytecode = True
88

99
# Menu ANSI Colors
1010
BLACK = '\033[30m'

tools/general_process_profiler.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
import os
44
import textwrap
55
import subprocess
6-
import sys
7-
sys.dont_write_bytecode = True
86

97
# Menu ANSI Colors
108
BLACK = '\033[30m'
@@ -121,4 +119,4 @@ def worker():
121119
worker()
122120
"""
123121
# Write the template into a config
124-
write_to_file(os.path.abspath(f"../watch_list/{sanitized_filename}.py"), textwrap.dedent(template))
122+
write_to_file(os.path.abspath(f"../watch_list/{sanitized_filename}.py"), textwrap.dedent(template))

tools/memory_process_profiler.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
import os
44
import textwrap
55
import subprocess
6-
import sys
7-
sys.dont_write_bytecode = True
86

97
# Base Directory
108
base_dir = os.path.dirname(os.path.abspath(__file__))
@@ -128,4 +126,3 @@ def worker():
128126
"""
129127
# Write the template into a config
130128
write_to_file(os.path.abspath(f"../watch_list/{sanitized_filename}.py"), textwrap.dedent(template))
131-

0 commit comments

Comments
 (0)