Skip to content

Instantly share code, notes, and snippets.

View xluffy's full-sized avatar
😶
&>/dev/null

xluffy xluffy

😶
&>/dev/null
View GitHub Profile
@xluffy
xluffy / systemd-sysv.md
Last active August 29, 2015 14:03
systemd - Convert A SysV Init Script Into A systemd Service File

Theo truyền thống, các dịch vụ (services or daemons) trên Linux hoặc Unix được khởi động thông qua một SysV init script. Chúng thực chất là các kịch bản Bourne Shell, thường được đặt trong một thư mục như /etc/rc.d/init.d và được gọi với một vài đối số (động từ) như start, stop hoặc restart, tức là dùng để khỏi động, tắt hoặc khỏi động lại dịch vụ.

Start thường liên quan đến việc gọi một dịch vụ nhị phân , sau đó fork ra một tiến trình nền (chính xác hơn l là daemonizes). Kịch bản shell có xu hướng chậm, khó đọc, dài dòng và mong manh. Mặc dù chúng vô cùng linh hoạt (sau cùng thì cũng chỉ là code), nhưng có một vài điểm rất khó làm đúng với một kịch bản shell, ví dụ ra lệnh thực hiện song song (parallelized), giám sát chính xác các tiến trình hoặc cấu hình các bối cảnh thực hiện một cách chi tiết.

@xluffy
xluffy / install-graphite-centos-6.5.sh
Last active April 6, 2016 03:04
install-graphite-centos-6.5.sh
#!/bin/bash
## Update system
cd
yum update -y
## Install base package
@xluffy
xluffy / Install Gitit on Ubuntu 12.04 server.md
Last active August 29, 2015 14:11
Install Gitit on Ubuntu 12.04 server

Env

Môi trường: Ubuntu 12.04 server, x86_64

Service: Gitit (haskell)

Mirror

Mirror FPT

~$ sudo sed -i 's/vn.archive.ubuntu.com/mirror-fpt-telecom.fpt.net/g' /etc/apt/sources.list
@xluffy
xluffy / install_taiga_ubuntu.sh
Last active May 8, 2016 06:25
taiga.io install on ubuntu 12.04
#!/bin/bash
# Ref: http://taigaio.github.io/taiga-doc/dist/setup-production.html
## 1. Intro
# The Taiga platform consists of three main components:
# - taiga-back (backend/api)
# - taiga-front (frontend)
# - taiga-events (websockets gateway) (optional)
# nginx config for A+ SSL Labs rating as of 9-2014
# Broad legacy compatibility including IE8/XP, Android 2.3+, openssl 0.9.8 clients
# Blocks most bot scans IP probes.
#
# *** Assumes: _HOSTNAME_ is replaced ***
#
# Includes OCSP stapling, HSTS Strict Transport security,
# session resumption, legacy backwards compatibility (XP, Android 2.3-4.3)
#
# Requires nginx 1.6.x. See: http://nginx.org/en/linux_packages.html, e.g.:
1. OpenBox
sudo apt-get install xorg openbox
su - x
vncpasswd ->>>> gitcmnhub
#!/bin/bash
PATH="$PATH:/usr/bin/"
export USER="x"
server {
listen 80;
server_name demo.wp.com;
root /home/wp/public;
index index.php index.html index.htm;
access_log /var/log/nginx/wp_access.log;
error_log /var/log/nginx/wp_error.log;
@xluffy
xluffy / quine1.sh
Created May 5, 2015 03:37
quine1.sh
#!/bin/bash
cat $0