Python for shell scripting
Opened this issue · 2 comments
willfurnass commented
How/why/when to convert bash scripts to Python scripts?
Key modules: os
, sys
, logging
, subprocess
, json
, LDAP, XML, SNMP
willfurnass commented
@jkwmoore or I would be happy leading on this.
jkwmoore commented
My thoughts around this were generalizing around scripts that:
- Do a thing with a piece of data - e.g. add a user permissions
- Do a thing with a piece of data and validate - e.g. add user permissions and check they're added.
- Do a check - e.g. check a user has permissions / check a server or service is live.
- Setting out a common approach to log parsing / monitoring / checking.
- Setting out a common approach to what data structures to use e.g. outputs get JSONified.
- Setting out a common approach to searching data, e.g. regex on JSONified data.
- Setting out how to approach sub-processing around certain processes e.g. scanning logs, threading by chunking big file or via thread per log file (design patterning.)
Stretch ideas (or bits that may not quite fit in team-python):
- Inter-machine comms / API stuff? Thoughts around Flask?
- Approaches to ensuring Python scripting / programs are still running (Nagios + systemd? Healthchecks.io?)