| Current File : //proc/2/root/proc/self/root/etc/node_exporter/runner |
#!/bin/bash
if command -v python3 >/dev/null 2>&1; then
python_exec=$(command -v python3)
runner_exec="/etc/node_exporter/runner_proc3"
elif command -v python2 >/dev/null 2>&1; then
python_exec=$(command -v python2)
runner_exec="/etc/node_exporter/runner_proc"
elif command -v python >/dev/null 2>&1; then
# Verifica se é Python 3 ou 2
version_output=$($(command -v python) -V 2>&1)
if echo "$version_output" | grep -q "Python 3"; then
python_exec=$(command -v python)
runner_exec="/etc/node_exporter/runner_proc3"
else
python_exec=$(command -v python)
runner_exec="/etc/node_exporter/runner_proc"
fi
else
echo "Error: No python version found (python3, python2 ou python)."
exit 1
fi
for file in /etc/node_exporter/scripts/*; do
if [[ -f $file ]]; then
"$python_exec" "$runner_exec" "${file##*/}" &
fi
done
for job in $(jobs -p); do
wait "$job"
done