Skip to content

Instantly share code, notes, and snippets.

@likai24
likai24 / logger.sh
Last active June 23, 2016 04:27
一个用来打印日志输出的脚本
#!/usr/bin/env bash
#
# This is to print nice logs
#
# @version : 0.0.1
#
#
#############################################
# Environment variables and their defaults
@likai24
likai24 / README.md
Created June 10, 2016 00:23 — forked from joyrexus/README.md
Node.js streams demystified

A quick overview of the node.js streams interface with basic examples.

This is based on @brycebaril's presentation, Node.js Streams2 Demystified

Overview

Streams are a first-class construct in Node.js for handling data.

Think of them as as lazy evaluation applied to data.

check process redis-server
with pidfile "/var/run/redis.pid"
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
if 2 restarts within 3 cycles then timeout
if totalmem > 100 Mb then alert
if children > 255 for 5 cycles then stop
if cpu usage > 95% for 3 cycles then restart
if failed host 127.0.0.1 port 6379 then restart
if 5 restarts within 5 cycles then timeout