CentOS7: HOWTO show running services

[root@tony ~]# systemctl --no-page -t service -a --state running --no-legend
auditd.service           loaded active running Security Auditing Service
crond.service            loaded active running Command Scheduler
dbus.service             loaded active running D-Bus System Message Bus
dovecot.service          loaded active running Dovecot IMAP/POP3 email server
getty@tty1.service       loaded active running Getty on tty1
gssproxy.service         loaded active running GSSAPI Proxy Daemon
lvm2-lvmetad.service     loaded active running LVM2 metadata daemon
NetworkManager.service   loaded active running Network Manager
ntpd.service             loaded active running Network Time Service
polkit.service           loaded active running Authorization Manager
postfix.service          loaded active running Postfix Mail Transport Agent
rsyslog.service          loaded active running System Logging Service
sshd.service             loaded active running OpenSSH server daemon
systemd-journald.service loaded active running Journal Service
systemd-logind.service   loaded active running Login Service
systemd-udevd.service    loaded active running udev Kernel Device Manager
tuned.service            loaded active running Dynamic System Tuning Daemon
vmtoolsd.service         loaded active running Service for virtual machines hosted on VMware
wpa_supplicant.service   loaded active running WPA Supplicant daemon
[root@tony ~]#

Here's a fun little script using the Google Maps Geocoding API:


[pete@server1 ~]# cat latlong.sh
#!/bin/bash

if [[ -z $@ ]]; then 
  echo "Works better with an address..."
  exit 1
fi
if [[ ! -x /usr/bin/curl ]]; then 
  echo "ERROR: Can't work without /usr/bin/curl"
  exit 1
fi
if [ ! -x /usr/bin/xml2 ]; then 
  echo "ERROR: Please install package xml2 from the EPEL repo first."
  exit 1
fi

address="$(echo $@ | sed 's/ /+/g')"

curl -s "http://maps.googleapis.com/maps/api/geocode/xml?address=${address}" \
     -o /tmp/file.xml

eval $(xml2 < /tmp/file.xml | tr '/, ' '___' | grep =)

if [[ $_GeocodeResponse_status == "OK" ]]; then
  echo "Address: $(echo $address | sed 's/+/ /g')"
  echo "Lattitude: $_GeocodeResponse_result_geometry_location_lat"
  echo "Longitude: $_GeocodeResponse_result_geometry_location_lng"
else
  echo "No results"
fi

exit 0

[pete@server1 ~]# ./latlong.sh 1600 Pennsylvania Ave, Washington, DC
Address: 1600 Pennsylvania Ave, Washington, DC
Lattitude: 38.8791981
Longitude: -76.9818437
[pete@server1 ~]#


Awesome!