Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite024d05

Browse files
committed
Parametrize configuration file name
1 parent70ad37e commite024d05

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

‎umonitor‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import daemon
1010

1111
classUmonitor(Screen):
1212

13-
def__init__(self,config_folder):
13+
def__init__(self,config_folder,conf_fn):
1414
self.config_folder=config_folder
15-
self.config_file=config_folder+"/umon.conf"
15+
self.config_file=config_folder+conf_fn
1616
self.dry_run=False
1717
self.connected=False
1818
self._exec_scripts=True
@@ -215,7 +215,7 @@ class Umonitor(Screen):
215215
defexec_scripts(self,profile_name):
216216
os.environ["UMONITOR_PROFILE"]=profile_name
217217
forscriptinos.listdir(self.config_folder):
218-
ifscript!="umon2.conf"andnotscript.startswith("."):
218+
ifscript!=conf_fn[1:]andnotscript.startswith("."):
219219
logging.info("Running script %s"%script)
220220
ifself.dry_run:
221221
continue
@@ -233,6 +233,7 @@ def main():
233233
exceptKeyError:
234234
raiseException("Need home environment variable to locate configuration file.")
235235
config_folder=home+"/.config/umon"
236+
conf_fn="/umon.conf"
236237

237238
parser=argparse.ArgumentParser(description="Manage monitor configuration.")
238239

@@ -249,7 +250,7 @@ def main():
249250
parser.add_argument("-f","--force",dest="force_load",action="store_true",help="disable all outputs even if they do not change during loading")
250251
parser.add_argument("--daemonize",dest="_daemonize",action="store_true",help="daemonize when listening to events")
251252

252-
umon=Umonitor(config_folder)
253+
umon=Umonitor(config_folder,conf_fn)
253254
parser.parse_args(namespace=umon)
254255

255256
logging_map= {
@@ -260,7 +261,7 @@ def main():
260261
logger=logging.getLogger()
261262
logger.setLevel(logging_map[umon.verbose])
262263

263-
logging.debug("Looking here for config file: %s"%config_folder+"/umon.conf")
264+
logging.debug("Looking here for config file: %s"%config_folder+conf_fn)
264265
umon.run()
265266

266267

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp