Skip to content

Instantly share code, notes, and snippets.

@kenshinx
kenshinx / rsyslog.conf
Created December 15, 2014 10:11
rsyslog configure sample
# rsyslog configuration file
# note that most of this config file uses old-style format,
# because it is well-known AND quite suitable for simple cases
# like we have with the default config. For more advanced
# things, RainerScript configuration is suggested.
# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html
#### MODULES ####
@kenshinx
kenshinx / chk_haproxy.sh
Last active January 3, 2016 08:09
Keepalived + Haproxy VIP: 123.125.22.90 Master: 123.125.22.97 Backup: 123.125.22.98 Server1: 123.125.22.99 Server2: 123.125.22.100
# author: weizhifeng
status=$(ps aux|grep haproxy | grep -v grep | grep -v bash | wc -l)
if [ "${status}" = "0" ]; then
/etc/init.d/haproxy start
status2=$(ps aux|grep haproxy | grep -v grep | grep -v bash |wc -l)
if [ "${status2}" = "0" ]; then
/etc/init.d/keepalived stop
@kenshinx
kenshinx / haproxy.conf
Created January 15, 2014 09:29
Haproxy load balance. haproxy:123.125.22.97 server1:123.125.22.99 server2:123.125.22.100
# this config needs haproxy-1.1.28 or haproxy-1.2.1
global
log 127.0.0.1 local3 debug
#log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 65535
#chroot /usr/share/haproxy
user haproxy
group haproxy
@kenshinx
kenshinx / keepalived.lvs.backup.conf
Last active June 13, 2018 11:47
Keepalived + LVS configuration template. VIP: 123.125.22.90 Master: 123.125.22.97 Backup: 123.125.22.98 RealServer1: 123.125.22.99 RealServer2: 123.125.22.100 Loadbalance algorithm: wrr Loadbalance type: DR
! Configuration File for keepalived
global_defs {
notification_email {
[email protected]
}
notification_email_from [email protected]
smtp_server mail.sina.com.cn
smtp_connect_timeout 30
router_id LVS_1
@kenshinx
kenshinx / keepalived.backup.conf
Last active January 2, 2016 13:49
Keepalived HA configuration file. Used for fail-over
! Configuration File for keepalived
2
3 global_defs {
4 notification_email {
5 [email protected]
6 }
7 notification_email_from [email protected]
8 smtp_server mail.sina.com.cn
9 smtp_connect_timeout 30
10 router_id LVS_DEVEL_252
@kenshinx
kenshinx / timer.lua
Created December 4, 2013 04:00
lua timer. based on luajit ffi load signal
--Lua timer library based on C signal.
--Notice: signal need Posfix system support
local ffi = require "ffi"
ffi.cdef[[
typedef void (*sighandler_t) (int32_t);
extern sighandler_t signal (int32_t signum, sighandler_t handler);
unsigned int alarm(unsigned int seconds);
]]
@kenshinx
kenshinx / config
Last active December 25, 2015 18:39
Nginx C Module.
addon_name=ngx_http_echo_module
HTTP_MODULES="$HTTP_MODULES ngx_http_echo_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_echo_module.c"
@kenshinx
kenshinx / supervisrord.conf
Created August 21, 2013 03:47
supervisord.conf with godns and joke
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
chmod=0777
chown=supervisord:supervisord
[inet_http_server]
port=1222
username=sinasec
password=hello
@kenshinx
kenshinx / rsync.conf
Created July 31, 2013 04:25
rsync 配置文件
pid file = /var/run/rsyncd.pid
port = 873
address = 0.0.0.0
uid = root
gid = root
use chroot = no
import threading
import requests
#Reference for weirong.
Max_concurrency = 50
def request(url):