V
V
Vadim2019-10-15 12:30:29
linux
Vadim, 2019-10-15 12:30:29

How to save bash script output to database?

Hello everyone,
you need a bash script that ssh into a remote computer and executes various commands there, such as updating the local repo, running other scripts, restarting docker containers, etc.
How can I make the output from this script, including the error output, be saved to the database? In any format!
Maybe it's better to use ansible instead of a script? Is it possible to save its output to the database? What database is better to use for such logs?
thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
paran0id, 2019-10-15
@paran0id

Ansible is better. Ansible output is saved to the log. The log can be parsed and put into the database. You can do the same with script output.

V
Victor Taran, 2019-10-15
@shambler81

Simplest

mysql -uПОЛЬЗОВАТЕЛЬ -pПАРОЛЬ БАЗА ДАННЫХ <<EOF
SQL_ЗАПРОС_1
SQL_ЗАПРОС_2
SQL_ЗАПРОС_N
EOF

don't forget to escape special characters

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question