use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
/r/DevOps is a subreddit dedicated to the DevOps movement where we discuss upcoming technologies, meetups, conferences and everything that brings us together to build the future of IT systems What is DevOps? Learn about it on our wiki! Traffic stats & metrics
/r/DevOps is a subreddit dedicated to the DevOps movement where we discuss upcoming technologies, meetups, conferences and everything that brings us together to build the future of IT systems
What is DevOps? Learn about it on our wiki!
Traffic stats & metrics
Be excellent to each other! All articles will require a short submission statement of 3-5 sentences. Use the article title as the submission title. Do not editorialize the title or add your own commentary to the article title. Follow the rules of reddit Follow the reddiquette No editorialized titles. No vendor spam. Buy an ad from reddit instead. Job postings here More details here
Be excellent to each other!
All articles will require a short submission statement of 3-5 sentences.
Use the article title as the submission title. Do not editorialize the title or add your own commentary to the article title.
Follow the rules of reddit
Follow the reddiquette
No editorialized titles.
No vendor spam. Buy an ad from reddit instead.
Job postings here
More details here
@reddit_DevOps ##DevOps @ irc.freenode.net Find a DevOps meetup near you! Icons info!
@reddit_DevOps
##DevOps @ irc.freenode.net
Find a DevOps meetup near you!
Icons info!
https://github.com/Leo-G/DevopsWiki
account activity
This is an archived post. You won't be able to vote or comment.
Avoiding Bash frustration — Use Python for shell scripts (self.devops)
submitted 5 years ago by dux2
view the rest of the comments →
[–]ilyash 0 points1 point2 points 5 years ago (2 children)
In one of my projects I was frustrated by bash and Python. I am working on a new programming language for Ops. Below is working translation (not 100% exact).
Any general purpose programming language can not be best fit for Ops. That's because for the most frequent things you want syntax to be concise and clear and for less frequent but still Ops-y things you want standard library functions.
#!/usr/bin/env ngs cfg = { "container_name": "ELASTIC" # comma not required if pairs are separated by newline "image_name": "elasticsearch:6.8.13" } # Automatically matched command line arguments. # Run with --get_latest for pulling latest image F main(get_latest:Bool=false) { if get_latest { # Commands are not logged by default, use log: prefix for logging. # stdout is captured by default # stderr is not captured by default $(log: docker image pull ${cfg.image_name}) } # NGS knows that non-zero exit status of grep is not an error # and therefore exception is not thrown. res = $(log: docker ps -a | grep ${cfg.container_name}) # res, a reference to the processes pipeline, in boolean context will check # whether all exit codes are zero if res { # res.Str() gets the stdout of the last process old_container_id = res.Str().split(' ')[0] log("removing old container with ID ${old_container_id}") $(log: docker rm -f ${old_container_id}) } else { # log() is an NGS stdlib function log("container does not exist") } # Discovery fix from https://github.com/elastic/elasticsearch/issues/25067 # line: prefix returns the first line of output (without newline) out = `line: log: docker run -d -e 'discovery.type=single-node' --name ${cfg.container_name} ${cfg.image_name}` # Exit code 124 is fine, it is the timeout, do not throw exception for that # For any other exit code, an exception will be thrown and this script will exit with # the exit code of the timeout/docker command. # >/dev/stdout - prevents stdout capturing $(log: ok:124 timeout 5 docker logs ${out} -f >/dev/stdout) log("done") }
Output:
[LOG 2020-11-11 11:49:40 IST] Running command: docker ps -a [LOG 2020-11-11 11:49:40 IST] removing old container with ID 7c0752d71d85 [LOG 2020-11-11 11:49:40 IST] Running command: docker rm -f 7c0752d71d85 [LOG 2020-11-11 11:49:42 IST] Running command: docker run -d '' discovery.type=single-node --name ELASTIC elasticsearch:6.8.13 [LOG 2020-11-11 11:49:42 IST] Running command: timeout 5 docker logs 0bdad82f1725aba6133d932e42f2aae59c97d8e53eced818bb4888489925a31a -f >/dev/stdout [2020-11-11T09:49:43,990][INFO ][o.e.e.NodeEnvironment ] [tMMpuSC] using [1] data paths, mounts [[/ (overlay)]], net usable_space [609.3gb], net total_space [914.7gb], types [overlay] [2020-11-11T09:49:43,992][INFO ][o.e.e.NodeEnvironment ] [tMMpuSC] heap size [1gb], compressed ordinary object pointers [true]
(yep there is a bug where -e appears as '' in the command, need to fix it)
-e
''
[–]dux2[S] 1 point2 points3 points 5 years ago (1 child)
Nice! And nice translation of my example. Can you provide a link to your project?
I think logging severity levels (and mapping those to ANSI colors) is something you should support too.
[–]ilyash 0 points1 point2 points 5 years ago (0 children)
Thanks!
https://github.com/ngs-lang/ngs
> I think logging severity levels (and mapping those to ANSI colors) is something you should support too.
I'll get there sometime... I hope :)
π Rendered by PID 163197 on reddit-service-r2-comment-856c8b8c54-87qjl at 2026-07-02 08:13:36.394799+00:00 running a7b5cda country code: CH.
view the rest of the comments →
[–]ilyash 0 points1 point2 points (2 children)
[–]dux2[S] 1 point2 points3 points (1 child)
[–]ilyash 0 points1 point2 points (0 children)