[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

[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"

[CentOS7][setting] after install

No Comments

GUI遠端桌面(RDP協定)
yum install xrdp
yum groupinstall “Desktop” “Xfce”

增加倉頡
http://oldgrayduck.blogspot.tw/2016/12/centos7.html

add display resolution in the list

How to Set A Custom Screen Resolution in Ubuntu Desktop

[Elasticsearch][Lucene] scoring 索引評分

No Comments

參考資料
https://lucene.apache.org/core/3_6_0/scoring.html

[backup][rsync]

No Comments

環境
1. 目錄 01-src 為資料來源
2. 目錄 02-dst 為資料備份
3. 目錄 03-bak 為備份過程中, 因備份動作產生的增刪檔案暫存區

情境一
[說明] 當 01-src 裡面有檔案被刪除時, 02-dst 在備份時也跟著要刪除同一檔案時, 會將被刪除的檔案, 利動到 03-bak
[指令]

rsync -av --delete ./01-src/ ./02-dst --backup --backup-dir=../03-bak

[結論] backup-dir 若不特別指定路徑的話, 就會被02-dst這個目錄做為當前目錄, 以我們的範例而言, 就是要用兩個點來退到上一層目錄去

[OS][Ubuntu] reboot slowly

No Comments

REF: https://askubuntu.com/questions/760952/slow-shutdown-on-ubuntu-16-04-lts-stopping-thermal-daemon-running-fit-make-remo

I have got the same Problem. It occurred after clean install Ubuntu 16.04. Finally I figured out, after lots of troubleshooting, that (after disable the Ubuntu boot splash screen) a certain stop-job was running that made the shutdown slow. (Thanks to Alex!) Then I got this error report:

a stop job is running for make remote cups printers available locally
Then I tried this:

sudo systemctl stop cups-browsed.service
sudo systemctl disable cups-browsed.service

To verify:

sudo systemctl status cups-browsed
sudo systemctl is-enabled cups-browsed

and it finally worked! Shutdown was now as good and fast as ever. (You can find this troubleshooting on: “The Annoying Cups Browsed” at the ec-cwang´s Blog!)

Older Entries Newer Entries