|
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - golfreeze
Pages: 1 2 3 [4] 5 6 ... 146
46
« on: กันยายน 04, 2022, 10:30:43 AM »
== create 10 files with extension .txt with xargs seq 10 | xargs -I {} touch {}.txt
47
« on: กันยายน 04, 2022, 10:25:30 AM »
=== text3 ==== store manager total_sales Woodridge,Australia Jon Stephens 33726.77 Lethbridge,Canada Mike Hillyer 33679.79 Bridge,Canada Mike Hillyer 43679.89 Sisaket,Thailand thong 562.22 Pathumthani,Thailand White 992.42 Saimai,Bangkok Packetlove 8229.4
=== text4 === store:manager:total_sales Woodridge,Australia:Stephens:33726.77 Lethbridge,Canada:Hillyer:33679.79 Bridge,Canada:Mike:43679.89 Sisaket,Thailand:thong:562.22 Pathumthani,Thailand:White:992.42 Saimai,Bangkok:Packetlove:8229.4
48
« on: กันยายน 04, 2022, 10:24:46 AM »
##show second column contain word "account" awk '$2 ~ account {print} ' filenamel
##show first column start with "e" in file check.sh awk '$1 ~ /^e/ {print } ' check.sh
##show first column start with not contain "e" in file check.sh awk '$1 !~ /^e/ {print } ' check.sh
##search and grep "account" from file awk '/account/ {print } ' check.sh awk '/^account/ {print }' check.sh
##if > < >= <= && || finding $5 more than 2000 and less than 2500 then print awk '$5 > 2000 && $5 <2500 {print $0}' check.sh
##if > < >= <= && || finding $5 more than 2000 or $5 not contain "sal" in line then print awk '$5 > 2000 || $5 !~ /sal/ {print $0}' check.sh
##if need change first line with specific "Start processing" and grep "account" awk 'BEGIN {print "Start processing"} {print $0}' check.sh awk 'BEGIN {print "Start processing"} /account/ {print $0}' check.sh
###if need add BEGIN and END of awk and grep "account" awk 'BEGIN {print "Start processing"} /account/ {print $0} END {print "End processed"}' check.sh
##if need count NR=Number record , NF=Number of field awk '{print NR,$0,NF} END {print "End processed"}' check.sh
##if need print LAST Field $NF awk '{print NR,$0,$NF,FILENAME} ' check.sh
##if need only line4 until line8 in file to show awk 'NR==4,NR==8 {print $0}' check.sh awk 'NR==4,NR==8 {print $0}' check.sh | awk '$3 ~ /username/'
##if substitute space with some character use OFS=output field substitute => if see space " " then replace with "@@" awk 'NR==4,NR==8 {print $0}' check.sh | awk 'BEGIN{OFS="@@"} {print $2,$3}' awk 'BEGIN {print "Start processing"} {print $0}' text3 | awk 'BEGIN{OFS="@"} {print $1,$2".com"}'
##if substitute space with some character use FS=field substitute => if see ":" then replace with space " " awk 'BEGIN{FS=":"} {print $2,$3}' text4
##if substitute space with some character use FS=field substitute => if see ":" then replace with "@@" awk 'BEGIN{FS=":";OFS="@@"} {print $2,$3}' text4
##if substitute last character in file use ORS=":" with : awk 'BEGIN {print "Start processing"} {print $0}' text3 | awk 'BEGIN{OFS="@";ORS=":"} {print $1,$2".com"}' output=> Start@processing.com:store@manager.com:Woodridge,Australia@Jon.com:Lethbridge,Canada@Mike.com:Bridge, Canada@Mike.com:Sisaket,Thailand@Liamthong.com:Pathumthani,Thailand@White.com:Saimai,Bangkok@Packetlove.com:
###if need awk run if condition or run condition on script file awk '{if ($3 > 2000) print $0 }' text3 output=> store manager total_sales Woodridge,Australia Jon Stephens 33726.77 Lethbridge,Canada Mike Hillyer 33679.79 Bridge,Canada Mike Hillyer 43679.89 Saimai,Bangkok Packetlove 8229.4
awk '{if ($3 > 2000) print $0; else print "Low" }' text3 output=> store manager total_sales Woodridge,Australia Jon Stephens 33726.77 Lethbridge,Canada Mike Hillyer 33679.79 Bridge,Canada Mike Hillyer 43679.89 Low Low Saimai,Bangkok Packetlove 8229.4
###if need awk run if condition or run condition on script file awk -f script text4
###toupper=change small character to BIG capital leeter on first column , length=count length of character on $3 awk '{print toupper($1),length($3)} {print $0}' text3
49
« on: สิงหาคม 20, 2022, 03:01:02 AM »
===== DB Task ===== run import script in sql testdb=> \copy (select * from param_change_request where id in (161, 162)) TO '/home/testdb/backhour.csv' CSV HEADER;
แล้วสามารถไปดูที่ไฟล์ backhour.csv ได้ครับ
50
« on: สิงหาคม 20, 2022, 02:56:45 AM »
ถ้าเรามีการเตรียม สคิปในไฟล์ check_query_alter_update.sql เพื่อทำรายการใน db=testdb เราสามารถรันผ่าน command psql ได้ดังนี้
postgres=> \c testdb testdb=> \i 19aug2022_operation/Script/check_query_alter_update.sql ALTER TABLE
เท่านี้ครับผม
52
« on: เมษายน 14, 2022, 11:15:06 AM »
byobu command ctrl+a+c = new window ctrl+a+o = swap window ctrl+a+% = split vertical view
53
« on: เมษายน 12, 2022, 07:42:44 AM »
csf lfd stop alert email for nrpe on debian os directadmin กรณีมีอีเมลส่งมาแจ้ง เยอะ alert สามารถแก้ไขเพื่อไม่ให้ส่ง email จาก service csf ที่เป้นหัวข้อ lfd ได้โดย If debian enable “csf” need allow on csf.conf “TCP_in” and “TCP_out” and Disable lfd for resource usage Subject: lfd on packetlove.com: Excessive resource usage: nagios (494190 (Parent PID:494190)) From: < root@packetlove.com> Message-Id: < E1ne3x7-002N0R-7t@packetlove.com> Date: Tue, 12 Apr 2022 07:00:13 +0700 Time: Tue Apr 12 07:00:13 2022 +0700 Account: nagios Resource: Process Time Exceeded: 75567 > 1800 (seconds) Executable: /usr/local/nagios/bin/nrpe Command Line: /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -f PID: 494190 (Parent PID:494190) Killed: No --1649721613-eximdsn-849789542-- ==แก้ไขเพื่อไม่ให้ส่ง email ได้โดย vi /etc/csf/csf.pignore user:nagios exe:/usr/local/nagios/bin/nrpe cmd:/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -f ==reload csf rule 1 รอบ csf -r
54
« on: เมษายน 03, 2022, 06:23:36 PM »
ในกรณี disk เป็น volume group เราสามารถสั่ง check disk ระบุ partition ได้เลยครับ command[check_disk]=/usr/local/nagios/libexec/check_disk -w 6% -c 3% -p /
55
« on: เมษายน 03, 2022, 05:48:40 PM »
ในเครื่อง client ที่ติดตั้ง nrpe client ให้ allow port 5666 ด้วยนะครับเพื่อให้ฝั่ง server check_nrpe เข้ามาได้ครับ ufw allow 5666/tcp : )
56
« on: มีนาคม 31, 2022, 10:55:35 PM »
===== upgrade directadmin for centos,debian on tangmo 31mar2022 CHANNEL=current OS_SLUG=linux_amd64 COMMIT=$(dig +short -t txt "$CHANNEL-version.directadmin.com" | sed 's|.*commit=\([0-9a-f]*\).*|\1|') FILE="directadmin_${COMMIT}_${OS_SLUG}.tar.gz" curl --location --progress-bar --connect-timeout 10 " https://download.directadmin.com/${FILE}" --output "/root/${FILE}" tar xzf "/root/${FILE}" -C /usr/local/directadmin /usr/local/directadmin/directadmin p || true /usr/local/directadmin/scripts/update.sh echo 'action=directadmin&value=restart' >> /usr/local/directadmin/data/task.queue สุดท้าย restart da 1 รอบ systemctl restart directadmin แล้วลองเทสเข้า login da อีกที ###for FreeBSD plan for dhamma.packetlove.com 17mar2022 #downloads given directadmin build into /root dir FILE="directadmin_a3e4091814582ab3c0fecea62ff5c1f956e023da_freebsd_amd64.tar.gz" curl --location --progress-bar --connect-timeout 10 " https://download.directadmin.com/directadmin_a759259a6deeeb3977de8dc4387d275a9de8eaad_freebsd_amd64.tar.gz" --output "/root/directadmin_a759259a6deeeb3977de8dc4387d275a9de8eaad_freebsd_amd64.tar.gz" #extracts downloaded package to /usr/local/directadmin tar xzf "/root/directadmin_a759259a6deeeb3977de8dc4387d275a9de8eaad_freebsd_amd64.tar.gz" -C /usr/local/directadmin #runs post-upgrade permission fix step /usr/local/directadmin/directadmin permissions || true # runs other post upgrade fixes /usr/local/directadmin/scripts/update.sh # restarts directadmin แล้วลองเทสเข้า login da อีกที service directadmin restart
57
« on: มีนาคม 30, 2022, 10:57:05 PM »
ถ้าเจอ error โดยที่ check_nrpe บน freebsd 11.x , 12.x /usr/local/nagios/libexec/check_nrpe -H 103.86.y.x -c check_home CHECK_NRPE: (ssl_err != 5) Error - Could not complete SSL handshake with 103.86.y.x : 1
==install nrpe3 #pkg install net-mgmt/nrpe3 Proceed with this action? [y/N]: y [1/2] Fetching nrpe3-3.2.1.txz: 100% 46 KiB 9.5kB/s 00:05 [2/2] Fetching nagios-plugins-2.3.3_2,1.txz: 100% 400 KiB 204.7kB/s 00:02 Checking integrity... done (0 conflicting) [1/2] Installing nagios-plugins-2.3.3_2,1... [1/2] Extracting nagios-plugins-2.3.3_2,1: 100% [2/2] Installing nrpe3-3.2.1... ===> Creating groups. Using existing group 'nagios'. ===> Creating users Using existing user 'nagios'. ===> Creating homedir(s) [2/2] Extracting nrpe3-3.2.1: 100% ===== Message from nrpe3-3.2.1:
-- Enable NRPE in /etc/rc.conf with the following line:
nrpe3_enable="YES"
A sample configuration is available in /usr/local/etc/nrpe.cfg.sample. Copy to nrpe.cfg where required and edit to suit your needs.
58
« on: กุมภาพันธ์ 27, 2022, 10:57:23 PM »
ในกรณีที่ทำการ อัฟเดท directadmin license key แล้วแต่ก็ยังเข้าไม่ได้ ต้องทำการอัฟเดท da ดูนะครับ เบื้องต้นแนะนำให้ทำ snapshot ไว้ก่อนนะครับ ตามด้วย backup configure บน /usr/local/directadmin/conf /usr/local/directadmin/custombuild /usr/local/directadmin/script หลังจากทำเสร็จให้ทำการ รัน command /usr/local/directadmin/scripts/getDA.sh current แล้วทำการ restart directadmin 1 รอบ systemctl restart directadmin เท่านี้ก็จะเข้าใช้งานได้ละครับ
59
« on: กุมภาพันธ์ 27, 2022, 08:27:16 PM »
ในการนำ certificate ไปใส่ใน exim.cert จะต้องนำ certificate.crt , ca-bundle , trust-root.ca , ca cert ต่างๆใส่ให้ครบ โดยสามารถเรียงลำดับได้ดังนี้ -----BEGIN CERTIFICATE----- content ของ certificate.crt -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- ca-bundle , ca cert -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- rust-root.ca -----END CERTIFICATE-----
แล้วทำการ restart service exim , dovecot จะสามารถใช้งานได้ครับผม
60
« on: กุมภาพันธ์ 23, 2022, 05:25:15 PM »
เราสามารถ monitoring spamrate การส่งเมลเข้าไปหา gmail ได้โดยทำการแอด domain เข้าระบบ postmaster https://postmaster.google.com/managedomains?pli=1แล้วทำการยืนยัน txt record ใส่บน zonefile ของโดเมนเรา แล้วจะสามารถเชคได้ครับผม
Pages: 1 2 3 [4] 5 6 ... 146
|
|
|