sendEmail

sendEmail是一个轻量级,命令行的SMTP邮件客户端。如果你需要使用命令行发送邮件,那么sendEmail是非常完美的选择:使用简单并且功能强大.这个被设计用在phpbash

perlweb站点使用。

下载安装sendEmail

1

2

3

4

sendEmail下载地址:http://caspian.dotconf.net/menu/Software/SendEmail/

# wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz //下载1.56版本

# tar -xzvf sendEmail-v1.56.tar.gz //解压后就可以使用了

# mv sendEmail /usr/local/bin/

发送邮件

1

2

3

#  /usr/local/bin/sendEmail -f ttlsafrom@163.com -t ttlsato@qq.com \

    -s smtp.163.com -u 我是邮件主题 -o messagecontenttype=html \

    -o messagecharset=utf8 xu ttlsafrom@163.com -xp 123456 -m 我是邮件内容

命令说明:

1

2

3

4

5

6

7

8

9

/usr/local/bin/sendEmail 命令主程序

f ttlsafrom@163.com  发件人邮箱

s smtp.163.com       发件人邮箱的smtp服务器

u 我是邮件主题     邮件的标题

o messagecontenttype=html   邮件内容的格式,html表示它是html格式

o messagecharset=utf8        邮件内容编码

xu ttlsafrom@163.com          发件人邮箱的用户名

xp 123456               发件人邮箱密码

m 我是邮件内容        邮件的具体内容

发送成功之后会有如下提示:

Jul 29 15:02:53 e10074 sendEmail[26347]: Email was sent successfully!

sendEmail使用命令帮助

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

[root@li229122 scripts]# sendEmail –help

sendEmail1.56 by Brandon Zehm <caspian@dotconf.net>

Synopsis:  sendEmail -f ADDRESS [options]

Required:

f ADDRESS                from (sender) email address

* At least one recipient required via t, cc, or bcc

* Message body required via m, STDIN, or -o messagefile=FILE

Common:

t ADDRESS [ADDR …]     to email address(es)

u SUBJECT                message subject

m MESSAGE                message body

s SERVER[:PORT]          smtp mail relay, default is localhost:25

Optional:

a   FILE [FILE …]      file attachment(s)

cc  ADDRESS [ADDR …]   cc  email address(es)

bcc ADDRESS [ADDR …]   bcc email address(es)

xu  USERNAME             username for SMTP authentication

xp  PASSWORD             password for SMTP authentication

Paranormal:

b BINDADDR[:PORT]        local host bind address

l LOGFILE                log to the specified file

v                        verbosity, use multiple times for greater effect

q                        be quiet (i.e. no STDOUT output)

o NAME=VALUE             advanced options, for details try: help misc

o messagecontenttype=<auto|text|html>

o messagefile=FILE         -o messageformat=raw

o messageheader=HEADER     -o messagecharset=CHARSET

o replyto=ADDRESS          -o timeout=SECONDS

o username=USERNAME         -o password=PASSWORD

o tls=<auto|yes|no>         -o fqdn=FQDN

Help:

help                    the helpful overview youre reading now

help addressing         explain addressing and related options

help message            explain message body input and related options

help networking         explain s, b, etc

help output             explain logging and other output options

help misc               explain -o options, TLS, SMTP auth, and more

转自 <http://www.ttlsa.com/linux/use-sendemail/>

SQL分页简单语句

DECLARE @pageSize int
DECLARE @pageIndex int
set @pageSize= 30
set @pageIndex=4

SELECT TOP (@pageSize) *
FROM Student
WHERE snumber NOT IN
(SELECT TOP (@pageSize * (@pageIndex-1)) snumber FROM Student)

DECLARE @pageSize int
DECLARE @pageIndex int
set @pageSize= 10
set @pageIndex=1

SELECT *
FROM ( SELECT TOP ( @pageSize * @pageIndex )
ROW_NUMBER() OVER ( ORDER BY dbo.student.snumber ) AS rownum ,
*
FROM dbo.Student
) AS temp
WHERE temp.rownum > ( @pageSize * ( @pageIndex – 1 ) )

ORDER BY temp.SNumber

zabbix安裝记录

zabbix安装步骤

一,数据库安装:

1. 下载mysql的repo源
# rpm -ivh https://repo.mysql.com//mysql57-community-release-el7-9.noarch.rpm

3. 安装mysql
# yum install mysql-server

4. 重置密码
# grep “password” /var/log/mysqld.log
MySQL>ALTER USER USER() IDENTIFIED BY ‘12345678’;
$ service mysqld start

二,zabbix安装
1.安装rpm包:
rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

2.安装zabbix:
yum install zabbix-server-mysql zabbix-web-mysql

3.创建数据库:
shell> mysql -uroot -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by ‘你的密码’;
mysql> quit;

4.导入数据:
#zcat /usr/share/doc/zabbix-server-mysql-3.2.*/create.sql.gz | mysql -uzabbix -p zabbix

5.编辑配置文件:
# vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=

6.编辑zabbix前端的PHP配合配置
# vim /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai

7.启动相关服务:
# systemctl start zabbix-server
# systemctl start httpd

其他注意点
1.selinux修改配置文件
/etc/selinux/config
SELINUX=enforcing改为SELINUX=disabled
重启机器即可

2.禁用防火墙
systemctl stop firewalld.service #停止
systemctl disable firewalld.service #禁用

3.改字體
字体上传至/usr/share/zabbix/fonts ;
# vim /usr/share/zabbix/include/defines.inc.php

将:define(‘ZBX_FONT_NAME’, ‘DejaVuSans’);
替换成:define(‘ZBX_FONT_NAME’, ‘字体名字’);

将define(‘ZBX_GRAPH_FONT_NAME’, ‘DejaVuSans’);
替换成:define(‘ZBX_GRAPH_FONT_NAME’, ‘字体名字’);

Zabbix log所在路径:
/var/log/zabbix/zabbix_server.log

zabbix_agentd配置文件路径:
/etc/zabbix/zabbix_agentd.conf

Windows 安裝agent
c:\bin\win64\zabbix_agentd.exe -c c:\conf\zabbix_agentd.win.conf -i

c:\bin\win64\zabbix_agentd.exe -c c:\conf\zabbix_agentd.win.conf -s

-d表示卸载