[script] 利用 sed 指令, 啟動或停用 crontab 裡的特定項目

No Comments

用來關閉某個項目的 script

#!/bin/bash
####  列出目前的 crontab
path="/home/joechen/test"
crontab -l > "$path"/crontab.current

####  替換現有規則
if [ -z "$1" ]; then
  echo "key-patten or program-name is not set."
else
  #patten="$1"
  sed -e 's/.*'$1'/#&/' "$path"/crontab.current > "$path"/crontab.new
  crontab "$path"/crontab.new
fi

用來開啟某個項目的 script

#!/bin/bash
####  列出目前的 crontab
path="/home/joechen/test"
crontab -l > "$path"/crontab.current

####  替換現有規則
if [ -z "$1" ]; then
  echo "key-patten or program-name is not set."
else
  sed -e '/'$1'/s/^#//' "$path"/crontab.current > "$path"/crontab.new
  crontab "$path"/crontab.new
fi

[ES][Elasticsearch] 2.x v.s 5.x

No Comments

http://wzktravel.github.io/2017/01/18/elasticsearch-upgrade-to-5-1-2-from-2-3-5/

[elasticsearch][2.x to 5.x] all new start…..

No Comments

如果是在 centos 7 的環境
一般是從官網下載的 ELK 套件(RPM)
安裝好就能動, 需要改動的設定不多

如果是要套用以前的設定, 如 logstash, 常常會有自訂的設定或引用
記得參考路徑要改正確, 不然會一直起不來, 但又沒法看出設定上的錯誤

——————————————————————————–
另外, GeoIP 在 logsatsh 2.x版是用 GeoIP的 version 1 (dat)
到了 logstash 5.x 版以後, 已支援 GeoIP 的 veresion 2 (mmdb)
也記得要改一下參考路徑, 不過好在其他的設定是不用動的(例如, country_code2, longitude, latitude…)

https://www.elastic.co/guide/en/logstash/current/plugins-filters-geoip.html

——————————————————————————–
https://github.com/lmenezes/cerebro/releases
2.x 常用的 head, kopf 的 es plugins 也要不能用
5.x 有建議使用 cerebro (kopf 的新名稱)
https://www.elastic.co/blog/running-site-plugins-with-elasticsearch-5-0

[Nessus][CA Cert] setting my own cert files

No Comments

Let’s Encrypt
after run the command “certbot”, and got the cert files in the

cd /etc/letsencrypt/archive/your-domain-name/
cp "./privkey1.pem" "/opt/nessus/var/nessus/CA/serverkey.pem"
cp "./cert1.pem" "/opt/nessus/com/nessus/CA/servercert.pem"