Linux-将命令的STDOUT发送到RSS Feed [英] Linux - Send STDOUT of command to an RSS Feed
问题描述
我希望使用个人RSS Feed进行系统报告,所以我想知道是否可以创建一个脚本,将其$ 1发送到RSS feed,例如self_test_command > rss_report.sh
.我目前也没有设置RSS提要,那么设置从Linux机器上运行的RSS提要最简单的方法是什么?
在command line
中,我为您提供了一个合适的解决方案.在后台使用Perl Template :: Toolkit 模块(无需立即学习Perl):>
首先安装软件包perl-template-toolkit
,然后创建模板文件rss.tpl
:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>[% title %]</title>
<description>[% desc %]</description>
</channel>
<!-- rest of the RSS -->
</rss>
并运行命令:
tpage --define title=foobar --define desc=description --interpolate rss.tpl
输出为:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>foobar</title>
<description>description</description>
</channel>
<!-- rest of the RSS -->
</rss>
您将在此处
找到完整的模板I'm looking to use a personal RSS Feed for system reporting, so I'm wondering if it's possible to create a script that sends its $1 to an RSS feed, ala self_test_command > rss_report.sh
. I don't currently have an RSS feed set up, either, so what would be the easiest way to set up an RSS feed running from a Linux box?
I have a proper solution for you, in command line
. That use Perl Template::Toolkit module in background (no need to learn Perl just now) :
first install the package perl-template-toolkit
, then create the template file rss.tpl
:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>[% title %]</title>
<description>[% desc %]</description>
</channel>
<!-- rest of the RSS -->
</rss>
And run the command :
tpage --define title=foobar --define desc=description --interpolate rss.tpl
Output is :
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>foobar</title>
<description>description</description>
</channel>
<!-- rest of the RSS -->
</rss>
You will find a complete template to modify here
这篇关于Linux-将命令的STDOUT发送到RSS Feed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!