You are not logged in.

#3376 2020-05-25 01:39:30

salonkommunist
Member
From: Germany
Registered: 2020-02-18
Posts: 25

Re: Post your handy self made command line utilities

That was really helpful. Thank you guys!

Offline

#3377 2020-05-26 09:04:49

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 28,710
Website

Re: Post your handy self made command line utilities

Been a while...

#!/usr/bin/bash
# Update mail certs

target="$HOME/.local/certs"
PS3='Select a host: '
options=("dom1" "dom2" "dom3")

select opt in "${options[@]}"
  do
    case "$opt" in
    dom1) domain="mail.dom1.com"
              name="one"
              break
              ;;
    dom2) domain="mail.dom2.com"
              name="two"
              break
              ;;
    dom3) domain="mail.dom3.com"
              name="three"
              break
              ;;
           *) printf "%s\n" "Invalid host"
              exit 1
              ;;
    esac
done

openssl s_client -connect "$domain":993 -showcerts 2>&1 < /dev/null |\
  awk '/BEGIN/,/END/{print}/END/{exit}' > "$target"/"$name".pem

# vim:set ts=2 sts=2 sw=2 et:

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB