一个简单的python http服务器来显示基本的系统信息。
hostinfo的Python项目详细描述
为什么?我有几个无头树莓派的人在做事情,我想要一个简单的十字架 平台的方式,看看他们是什么了。
安装
首选方法是将pip与pypi.org
pip install hostinfo
对于开发,您还可以执行以下操作:
git clone https://github.com/walchko/hostinfo.git cd hostinfo pip install -e .
用法
现在,为了确定您的IP和MAC地址,您需要提供 接口。你也可以提供一个端口来服务网页。加速 默认情况下,生成二维码是off。
kevin@Logan hostinfo $ infoserver.py --help usage: infoserver.py [-h] [-v] [-e ETHERNET] [-p PORT] [-q] Launches a server that reports host information via a static web page. Example: infoserver.py -p 8800 -e en0 -q optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit -e ETHERNET, --ethernet ETHERNET ethernet interface, default is eth0 -p PORT, --port PORT port, default is 5000
二维码阅读器
我的iphone上的qr阅读器的示例视图。
Raspbian[Debian Jessie]服务
现在您可以创建一个在计算机启动时始终启动的服务:
pi@bender hostinfo $ more /etc/systemd/system/hostinfo.service [Service] ExecStart=/usr/local/bin/infoserver.py -p 8080 -e eth0 -q Restart=always StandardOutput=syslog StandardError=syslog SyslogIdentifier=hostinfo User=pi Group=pi Environment=NODE_ENV=production [Install] WantedBy=multi-user.target
更改端口、以太网接口,并希望生成二维码 喜欢。创建此文件后,需要执行以下操作:
pi@bender hostinfo $ sudo systemctl enable hostinfo Created symlink from /etc/systemd/system/multi-user.target.wants/hostinfo.service to /etc/systemd/system/hostinfo.service. pi@bender hostinfo $ sudo service hostinfo start pi@bender hostinfo $ sudo service hostinfo status ● hostinfo.service Loaded: loaded (/etc/systemd/system/hostinfo.service; enabled) Active: active (running) since Sun 2017-01-22 13:14:26 MST; 7s ago Main PID: 28533 (infoserver.py) CGroup: /system.slice/hostinfo.service └─28533 /usr/bin/python /usr/local/bin/infoserver.py -p 8080 -e et... Jan 22 13:14:26 bender systemd[1]: Started hostinfo.service.
现在服务器已经启动并运行,只需启动浏览器并连接 到computer:port。例如,bender.local:8080,因为 我把它设置得太高了。
更改
Date | Version | Notes |
---|---|---|
2017-04-15 | 0.5.0 | using flask and support python 3.6 |
2017-01-22 | 0.2.1 | bug fixes, working on macOS and Raspbian. |
2017-01-21 | 0.1.0 | init |
许可证
MIT许可证(MIT)
版权所有(c)2017 Kevin J.Walchko
兹免费准许任何人取得 本软件和相关文档文件(“软件”),用于处理 不受限制的软件,包括但不限于 使用、复制、修改、合并、发布、分发、再授权和/或销售副本 以及允许向其提供软件的人员 因此,必须满足以下条件:
上述版权公告及本许可公告须包括在 软件的拷贝或大部分。
本软件按“原样”提供,无任何形式的保证,明示或 默示的,包括但不限于适销性、适用性的保证 为了特殊目的和不侵权。在任何情况下,作者或 版权持有人应对任何索赔、损害或其他责任负责,无论 在合同诉讼、侵权诉讼或其他诉讼中,由 与软件的连接或软件的使用或其他交易。