Skip to content

Instantly share code, notes, and snippets.

@RVIRUS0817
RVIRUS0817 / coreos-pythoninstall.sh
Last active November 16, 2016 03:57
shell script
#!/bin/bash
VERSIONS=${VERSIONS:-"2.7.8.10"}
# make directory
mkdir -p /opt/bin
cd /opt/bin
wget http://downloads.activestate.com/ActivePython/releases/${VERSIONS}/ActivePython-${VERSIONS}-linux-x86_64.tar.gz
tar -xzvf ActivePython-${VERSIONS}-linux-x86_64.tar.gz
@RVIRUS0817
RVIRUS0817 / keepalived.conf
Last active March 7, 2018 02:35
keepalived
virtual_server_group DOCKER_HTTP {
172.19.10.63 80
172.19.10.111 80
}
virtual_server group DOCKER_HTTP {
delay_loop 3
lvs_sched wrr
lvs_method NAT →Masp
@RVIRUS0817
RVIRUS0817 / vrrp.conf
Last active October 12, 2016 03:21
keepalived
vrrp_sync_group VG {
group {
VI
VE
}
notify_master /etc/keepalived/vrrp_master.sh
notify_backup /etc/keepalived/vrrp_backup.sh
notify_fault /etc/keepalived/vrrp_backup.sh
notify /etc/keepalived/vrrp_state.sh
### 1. make Disk Imange
qemu-img create -f qcow2 /var/lib/libvirt/images/cent7.qcow2 20G
### 2. install and boot guest server
virt-install \
--connect qemu:///system \
--name cent7 \
--vcpus=2 \
--ram=2048 \
--hvm \
@RVIRUS0817
RVIRUS0817 / kvm-cent7.cfg
Last active September 10, 2016 13:09
cfg
#version=RHEL7
# System authorization information
auth --enableshadow --passalgo=sha512
# Use network installation
url --url="http://xxx.xxx.xxx.xxx/os/7/os/x86_64/"
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=vda
# Keyboard layouts
@RVIRUS0817
RVIRUS0817 / scp-file.sh
Last active November 16, 2016 03:58
shell script
# /bin/sh
SERVERDIR=/home/adachin/work/server/http-conf
REPODIR=/home/adachin/work/server/httpd-conf
HTTPDIR=/etc/httpd/conf/local
#各サーバに飛ばす
for x in `seq 1 20`; do
echo "server$x"
scp $REPODIR/httpd.conf adachin@server$x:$SERVERDIR
@RVIRUS0817
RVIRUS0817 / db_csv_replication.sh
Last active November 16, 2016 03:58
shell script
# /bin/sh
#あってもなくても
#LOG=*-`date +\%Y-\%m-\%d --date "-1 days"`.log
#for文ですべてのテーブルを回す
for x in adachin01 adachin02 adachin03 adachin04; do
CSV=/db/$x-`date +\%Y-\%m-\%d`.csv
OLD_CSV=/db/$x-`date +\%Y-\%m-\%d --date "-1 days"`.csv
@RVIRUS0817
RVIRUS0817 / bbs.php
Last active October 8, 2017 12:24
PHP
<html>
<head>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
<style>
/*body{margin:20px;}*/
body {
padding-top: 50px;
}
.starter-template {
@RVIRUS0817
RVIRUS0817 / check-file.sh
Last active November 16, 2016 03:59
shell script
#!/bin/bash
#変数(testファイル/一時間前のtestファイル)
TEST=/hoge/test.txt.`date "+%Y%m%d-%H%M"`
TESTRM=/hoge
#一日前のtestファイルを削除
ssh -q adachin@lsyncd sudo -u adachin find $TESTRM -mtime +0 -exec rm -f {} \;
echo `date "+%Y-%m-%d %T"`
@RVIRUS0817
RVIRUS0817 / slack_scripts.sh
Last active November 16, 2016 03:59
shell script
#!/bin/sh
#Incoming WebHooksのURL
WEBHOOKURL="https://hooks.slack.com/hogeee"
#メッセージを保存する一時ファイル
MESSAGEFILE=$(mktemp -t webhooks)
#slack 送信チャンネル
CHANNEL="#hogeee"
#slack 送信名
BOTNAME="hogeee"