summaryrefslogtreecommitdiffstats
path: root/scripts/conky-atom.sh
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-04-16 10:30:15 +0200
committerSuren A. Chilingaryan <csa@suren.me>2018-04-16 10:30:15 +0200
commit55783753ae8f2d857a7225b7a93c1d47039e5a90 (patch)
treee077b61b0f004141712e7d16876f9c19175ac681 /scripts/conky-atom.sh
downloadconky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.gz
conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.bz2
conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.xz
conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.zip
OpenShift monitoring
Diffstat (limited to 'scripts/conky-atom.sh')
-rwxr-xr-xscripts/conky-atom.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/scripts/conky-atom.sh b/scripts/conky-atom.sh
new file mode 100755
index 0000000..2cd0192
--- /dev/null
+++ b/scripts/conky-atom.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+# RSS Display Script by Bill Woodford (admin@sdesign.us) v1.0
+#
+# This script is designed to output story titles for most any RSS Feed.
+#
+# This script depends on curl. Please ensure it is installed and in your $PATH
+# Gentoo: emerge -av net-misc/curl
+# Debian: apt-get install curl
+# Homepage: http://curl.haxx.se/
+#
+# Usage:
+# .conkyrc: ${execi [time] /path/to/script/conky-rss.sh URI LINES TITLENUM}
+# URI = Location of feed, ex. http://www.gentoo.org/rdf/en/glsa-index.rdf
+# LINES = How many titles to display (default 5)
+# TITLENUM = How many times the title of the feed itself is specified, usually 1 or 2 (default 2)
+#
+# Usage Example
+# ${execi 300 /home/youruser/scripts/conky-rss.sh http://www.foxnews.com/xmlfeed/rss/0,4313,1,00.rss 4 2}
+
+#RSS Setup - Don't change unless you want these values hard-coded!
+uri=$1 #URI of RSS Feed
+lines=$2 #Number of headlines
+titlenum=$3 #Number of extra titles
+if [ -n $4 ]; then
+ width=$4
+else
+ width=1024
+fi
+
+#Script start
+#Require a uri, as a minimum
+if [[ "$uri" == "" ]]; then
+ echo "No URI specified, cannot continue!" >&2
+ echo "Please read script for more information" >&2
+else
+ #Set defaults if none specified
+ if [[ $lines == "" ]]; then lines=5 ; fi
+ if [[ $titlenum == "" ]]; then titlenum=2 ; fi
+
+ #The actual work
+ atom=`curl -s --connect-timeout 30 $uri`
+ echo $atom |\
+ sed -e 's/<\/title>/<\/title>\n/g' |\
+ grep '<title' |\
+ sed -e 's/^.*<title/<title/' |\
+ sed -e 's#<\(/\?\)title>#<\1p>#g' |\
+ html2text -utf8 -width 65536 |\
+ cut -d '/' -f 2- | sed -e 's/-[[:digit:].r\-]\+:/:/' |\
+ tail -n +2 |\
+ head -n $(($lines + $titlenum)) |\
+ tail -n $(($lines)) |\
+ cut -c 1-`echo $((3 * $width))` |\
+ fmt -t -w $width
+
+fi