Skip to content

Commit f7efb43

Browse files
committed
fix: write full path of bash scripts to native zabbix-agent configuration file
1 parent d38c6dc commit f7efb43

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mamonsu/lib/runner.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def quit_handler(_signo=None, _stack_frame=None):
9898
path = commands[2][:len_path] + "/scripts"
9999
Plugin.PATH = path
100100
else:
101-
path = "./scripts"
101+
path = os.getcwd()
102102
Plugin.PATH = path
103103
# create directory for scripts along the path of conf file if needed
104104
if not os.path.exists(path):
@@ -110,8 +110,10 @@ def quit_handler(_signo=None, _stack_frame=None):
110110
f.write(template.txt(args.plugin_type, plugins)) # pass command type
111111
# write bash scripts for zabbix - agent to a file
112112
for key in Scripts.Bash:
113-
with codecs.open(path + "/" + key + ".sh", 'w', 'utf-8') as f:
113+
with codecs.open(path + "/" + key + ".sh", 'w+', 'utf-8') as f:
114114
f.write(Scripts.Bash[key]) # pass script itself
115+
os.chmod(path + "/" + key + ".sh", 0o744)
116+
print("Bash scripts for native zabbix agent have been saved to {0}".format(path))
115117
else:
116118
print_total_help()
117119
sys.exit(0)

0 commit comments

Comments
 (0)