博文

目前显示的是 十一月, 2017的博文

使用Python发邮件(顺便写了一个小工具以方便实验室服务器运维)

前言: 命令行方式发邮件是非常重要的一个功能,搞过服务器运维的同学们肯定深有感触。如果一台服务器的 ip 设置为自动分配,服务器每次重启都会改变 ip ,经常去机房查ip是一件非常抓狂的事情。我今天参考了一些资料学习了一下 sendmail ,写了个小脚本,支持发送图片/附件/html等,可以用来发送日志等。 源代码在这里: https://github.com/the0demiurge/Notes/blob/master/Languages/Python/sendmail/sendmail.py 我基于这个函数做了一个自动获取IP(ifconfig)和服务器日志(dmesg)的小脚本,在这里: https://github.com/the0demiurge/Notes/blob/master/Linux/Server_Maintenance/sendmail.py 大致的用法: 只需要构造三个字典变量: sender: 记录发送者的信息,包括smtp服务器地址(比如qq,163什么的一般都会提供,不过需要在设置里面开启smtp才行) receivers: 记录收邮件的人的信息,可以指定多个邮件接收者 mail: 定义邮件的内容,包括附件等信息。 配置示例: sender = { ' address ' : ' sender@domain.tld ' , ' nickname ' : ' My Name ' , ' password ' : ' password ' , ' smtp_server ' : ' smtp.domain.tld ' , ' smtp_port ' : 465 , } receivers = [( ' Your Name ' , ' receiver@domain.tld ' )] mail = { ' content ' : ' Email Content ' , ' content_html ' : '

[SOLVED] Supermicro cannot connect to VGA video port or iKVM

图片
Error Message: iKVM doesn't support add-on VGA device.  Please change the D-SUB connector to Add-on VGA device… TL;DR: Go HERE  and download Supermicro IPMI Utilities and install on your own PC Connect your server to the network (NOTICE: YOU MAY HAVE MORE THAN ONE NETWORK PORT, AND IF YOU DO NOT KNOW WHICH PORT SHOULD CONNECT TO THE NET, CONNECT THOSE ALL), power on and press "DEL" during startup until that error message come out There will be an IP showing on screen, keep it in your mind Go to your own PC, enter that IP on your web browser, if  you see a webpage below, go to next You may log in and change default username and password. The default username and password are both "ADMIN" Run IPMIView (downloaded at STEP 1). If you are using Windows, it's easy, and go to next step. In my PC (Ubuntu), you can just type:     tar xvaf IPMIView_2.13.0_build.170504_bundleJRE_Linux_x64.tar.xz     cd IPMIView_2.13.0_build.170504_bundleJRE_Lin

此博客中的热门博文

Flash被淘汰后打开swf文件的最佳方法

[SOLVED] Supermicro cannot connect to VGA video port or iKVM

MacBook日文键盘四种输入模式输入法切换(同样适用于其他布局的键盘)