Needed a list with all domains I run on a server but I don't always give nginx config files the names of their website so I was about to start going through them by hand..... waaait, let's try to automate this with a bash script...

Five minutes later I've got a working bash script which gets all domains from all config files.

Oh, the joys of terminal/bash stuff!

  • 2
    That sounds cool
  • 3
    Automation is freaking awesome
  • 2
    Oh I exactly know that feeling, man I currently have the same feeling at work... Saving some colleagues alot of time 😏 ... FeelsGoodMan. How are you btw?
  • 2
    Man I love to create those oneliners piping through those commands.
  • 2
    If I need to do it more than three times I’ll automate that shit
  • 2
    @Plasticnova Have you automated some basic human needs yet? It's getting tedious
  • 9
    @Jilano It’s already pretty automated. I mean I don’t monitor my bladder manually, it sends an alert when it’s about full. My power supply sends alerts when it needs more fuel, and so far I’ve always been able to wake from sleep on time thanks to the combo of wake-on-sun and circadian rhythm protocol. I’m happy with this setup thus far, but always open to suggestions.

    Although, a cron job to trim my hair might be nice
  • 0
    grep -R server_name /etc/nginx/sites-enabled

    That should be enough, shouldn't it?
  • 0
    @TheCommoner282 I also sweep out the duplicates and remove the ; char :)
  • 1
    @linuxxx hmm okay... And then a few pipes.

    | sort | uniq | cut

    But I would have to look up the cut syntax
  • 1
    This is why I entered dev world, solve things like this using code/scripts
    Write cool stuff and learn new things.

    Too bad job != that thing tho it pays :3
  • 0
    In my experience, shell scripting has been immensely useful.
  • 1
    @Plasticnova gold.

    You'd get a favorite (but I can't seem to favorite comments...)
  • 1
    sort | uniq seems unnaturally
    Try sort -u next time.
    Additionally for cut I usually go with -d’ ‘ -fN
  • 0
    Guys, check out thee ultimative plumber: https://github.com/akavel/up

    It provides an awesome interactive UI for creating this kind of piping command stuff things.
Add Comment