11 月 24
joechen未分類
REF: https://www.youtube.com/watch?v=-xg766aPYro
#!/bin/bash
datetime=`date +%Y-%m-%d`
rm -f HD-A1.txt ; rm -f index.html ; wget ftp://60.250.120.233:99/Android/img/ ; cat index.html | sed -e 's/<[^>]*>//g' | grep A1 > HD-A1.txt
mail -s "HD-A1 ROM is checked on $datetime" yourmail@gmail.com < HD-A1.txt
9 月 18
joechenAlfresco, 未分類
參考網頁
http://docs.alfresco.com/community/tasks/upgrade-process.html
–官網是這樣說–
為避免升級後的版本無法順利啟用, Alfresco 建議直接安裝新版本在新的路徑
並請管理者預先備分相關資料, 如:
1.設定組態檔 alfresco-global.properties 所指定的
dir.root目錄 (dir.root=/opt/alfresco-community/alf_data)
db.url目錄 (db.url=jdbc:postgresql://localhost:5432/alfresco)
2.索引設定檔 solrcore.properties 所指定的
date.dir.root目錄
(/opt/alfresco-community/solr4/archive-SpacesStore/conf/solrcore.properties)
(/opt/alfresco-community/solr4/workspace-SpacesStore/conf/solrcore.properties)
–以下是正式維運環境這樣做–
如果目錄名稱沒有要改, 資料庫名稱也沒有異動
可依以下步驟
1. service alfresco stop
2. login with root by X window
3. install Alfreso-new-version by wizard (don’t start service)
4. rsync -av alfresco-data-dir to new-alfresco-data-dir
5. edit alfresco-globle.properties
6.1 edit tomcat/bin/setenv.sh (JAVA_OPTS)
6.2 edit tomcat/scripts/ctl.sh
以下待服務啟動後再執行
7. edit tomcat/webapps/ROOT/index.jps (add script to document.location.href to /share/page)
8. use scripts to translate simp-chinese to trad-chinese by cn2tw-bat.sh
9. install AMPS (https://sourceforge.net/projects/aaar/files/v4.4/)
10. 修改 alfresco service (http://www.keensoft.es/en/our-road-from-alfresco-5-1-g-to-alfresco-201701/)
10. service alfresco start
重啟後, 可能要比較久才能重新使用
— end —
9 月 15
joechenELK, GNU/Linux
REF: https://www.zghhome.cn/?p=350
Access data from mySQL and output to ES
test1
test2
test3
test4
test5
test6
test7
############# input ##############
input {
jdbc {
jdbc_driver_library => "/usr/share/java/mysql-connector-java.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://192.168.7.79:3306/note"
jdbc_user => "dbuser"
jdbc_password => "password"
#parameters => {""}
schedule => "* * * * *"
statement => "select ID,post_date,post_title,ping_status from note_posts where id > :sql_last_value order by id"
#statement => "select ID,post_date,post_title,ping_status from note_posts"
# setting for last run
clean_run => false
record_last_run => true
use_column_value => true
tracking_column => id
last_run_metadata_path => "/usr/share/logstash/logstash_mydb-note_last_run"
type => "mydb-note"
}
}
###################################
############# filter ##############
###################################
############# output ##############
output {
# stdout { codec => "rubydebug" }
if [type] == "mydb-note" {
if !("_grokparsefailure" in [tags]) {
elasticsearch {
hosts => [ "127.0.0.1:9200" ]
index => [ "logstash-mydb-note" ]
}
} else {
elasticsearch {
hosts => [ "127.0.0.1:9200" ]
index => [ "logstash-failure-mydb-note" ]
} # ELK
} # else
} # if
}
8 月 31
joechen未分類
用來關閉某個項目的 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
8 月 29
joechenELK
http://wzktravel.github.io/2017/01/18/elasticsearch-upgrade-to-5-1-2-from-2-3-5/
8 月 09
joechen未分類
如果是在 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
8 月 08
joechen未分類
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"
Older Entries Newer Entries