Skip to content

Instantly share code, notes, and snippets.

@kerus1024
kerus1024 / run_multiple_process_with_features_restart_process_when_single_process_failed_and_daily_restarts.bash
Last active September 17, 2022 03:52
Bash Shellscript run_multiple_process_with_features_restart_process_when_single_process_failed_and_daily_restarts.bash
#!/bin/bash
PID=$$
RESTART_SECONDS_AFTER=15
get_date() {
echo $(TZ="Asia/Seoul" date +%Y%m%d)
}
run_jobs() {
$@ &
@kerus1024
kerus1024 / run_multiple_process_with_features_restart_process_when_single_process_failed.bash
Created September 11, 2022 09:47
Bash Shell Script Run multiple process with features that re-starts process when single process failed
#!/bin/bash
JOBS=()
run_jobs() {
$@ &
JOBS+=($!)
}
while true;
do
@kerus1024
kerus1024 / php freeradius add new user .sh
Last active August 6, 2022 08:55
php freeradius add new user
USERNAME="samsung"
PASSWORD="pass"
SQL="use radius; INSERT INTO radcheck (username, attribute, op, value) VALUES ('$USERNAME','User-Password',':=','$PASSWORD');"
mysql -u root -p radius <<EOF
$SQL
EOF
ip6tables --policy INPUT DROP;
ip6tables --policy OUTPUT ACCEPT;
ip6tables --policy FORWARD DROP;
ip6tables -Z;
ip6tables -F;
ip6tables -X;
ip6tables -t nat -F
ip6tables -t mangle -F
@kerus1024
kerus1024 / k8s-local-path.md
Created July 23, 2022 14:35
Kubernetes (K8S) Standalone Node : Use Local-Path Provisioner
@kerus1024
kerus1024 / socat-tcp-reverse-proxy.bash
Created July 23, 2022 14:24
Simple TCP Reverse Proxy by using socat
socat -d -d TCP4-LISTEN:10999,fork TCP:10.50.20.1:4000
@kerus1024
kerus1024 / debian11-k8s-standalone-cluster.bash
Last active July 23, 2022 14:18
debian11-k8s-standalone-cluster.bash
#!/bin/bash
set -xe
# kernel parameter
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
@kerus1024
kerus1024 / nodejs-xlsx-merge-test.js
Created June 11, 2022 18:24
NodeJS에서 xlsx파일 merge 프로그램 백업
//
// NodeJS에서 xlsx파일 merge 프로그램 백업
// express.js랑 묶여있어서 참고용
//
//
const UPLOAD_TMPDIR = `${process.cwd()}/uploads_tmp/`;
const UPLOAD_DIR = `${process.cwd()}/uploads/`;
const TypeAPPSTATUS = {
WAIT: 0,
#!/bin/bash
set -xe
PWD=$(pwd)
var_username="kerus1024"
var_userpass="temppass1234"
#var_rootpass="temppass1234"
var_sshport=1234
#var_sshpublickey=
#var_swapsize=4096
@kerus1024
kerus1024 / rocky8-k8s-ha-kubeadm.bash
Created June 2, 2022 17:17
Kubernetes HA Cluster Bootstrap / Control-plane / Worker
#!/bin/bash
# Rocky Linux 8
# https://www.linuxtechi.com/how-to-install-kubernetes-cluster-rhel/
set -x
set -e
# master 01 or 02,03/worker
SWITCH_PRIMARY=y