แสดงกระทู้

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 ... 146
16
Package on mac / disk cleanup on mac os with mac-cleanup
« on: เมษายน 13, 2023, 04:48:57 PM »
เราสามารถทำ clear พวกไฟล์ขยะใน mac os เพื่อเอาพื้นที่ใช้งานกลับคืนมาได้ ผ่าน command mac-cleanup นะครับ แต่ถ้ายังไม่มี ก็ brew มาได้เลย
$brew tap fwartner/tap
$brew tap fwartner/tap/mac-cleanup
$mac-cleanup

17
=== change mount /dev/sdb1 to mount with UUID
หลังจากทำ fdisk เสร็จให้ทำการ format เป็น
mkfs.xfs /dev/sdb1

แล้วทำการกำหนด blkid
sudo blkid /dev/sdb1
หรือ
sudo vol_id --uuid /dev/sdb1
จะได้ UUID ของ /dev/sdb1 ออกมา
แล้วทำการ mount ไว้ใน /etc/fstab ดังนี้
UUID="xxxxx-xxxxxx-xxxxxx" /nsm2 xfs defaults 0 1

แล้วสั่ง
#mount -a
ก็จะมี /nsm2 ถูก mount ขึ้นมากับบน UUID ของ /dev/sdb1

18
Proxmox เจอปัญหา
Connection error 401: permission denied - invalid PVE ticket
แก้ไขโดย
#systemctl restart pvedaemon pveproxy

และทำการ เข้าไปที่ /etc/pve
แล้วทำการ
#mv authkey.pub authkey_20230312.pub
หลังจากนั้นทำการ login เข้า ui ใหม่อีกรอบ

19
mongodb dump and restore only specific collection or table
database : test123
collection-name : ProductManager

===mongodump only collection
/usr/bin/mongodump -h localhost -d test123 --collection=ProductManager -o /home/test/backup_mongo/

===mongorestore only collection
mongorestore --db=test123 --collection=ProductManager /home/test/backup_mongo/test123/ProductManager.bson

20
# Send email inform admin
echo "Backup Mongod finish on ${FULLTIME}" | mail -s "Backup Mongod ${FULLTIME}  done" abe@gmail.com

21
== ถ้าต้องการ import public key แบบ custom path และระบุ passphrase เลย
gpg2 --import '/app/test/PKL.asc'
gpg2 --batch passparse=123xxPKL --symmetric filename

22
==expect command
/app/pklscript/sftp.sh
set DATE.[timestamp -format {%Y-%m-%d}]
$DATE

23
All about virtualization openstack + vmare esxi / reset user root on cli esx-i
« on: กุมภาพันธ์ 12, 2023, 03:03:03 PM »
**** ถ้าเจอกรณี login เข้า root ผ่านหน้า ui ไม่ได้ แสดงว่าอาจจะ โดน brute force จากหน้า ui
ต้องเข้าผ่าน account admin อีกตัว แล้วเข้าไปเปิด ssh แล้วทำการ un-locked user “root” *** ผ่าน command :
pam_tally2 --user root --reset

แล้วทำการ login ผ่านหน้าเวบ ui อีกที ถ้า login ได้ก็ปิด ssh service ด้วยนะครับ
 8)

24
command , shell script ,tool , crontab / memcache export and import with memcached-tools and nc
« on: กุมภาพันธ์ 07, 2023, 12:42:48 PM »
=== export memcache data from old-web
/usr/share/memcached/scripts/memcached-tool 127.0.0.1:11211 dump > memcache7feb.dumpall

### import memcache data into new-memcache node #
nc 127.0.0.1 11211 < oldweb_memcached7feb.dumpall

25
ถ้าต้องการเพิ่ม php-fpm pool เพื่อใช้งานใน nginx เพิ่มเติม เพื่อรองรับ web connection เพิ่มเติม สามารถทำได้ดังนี้

PKLLAB.com have php-fpm5.6 running 4 pool
If need to add pool add configure on
#cp /etc/php/5.6/fpm/pool.d/www4.conf /etc/php/5.6/fpm/pool.d/www5.conf
And change configure pool-name on www5.conf
From
www4->www5

And add configure on /etc/nginx/sites-available/pkllab.com
upstream php56_pkllab {
        server "unix:/run/php/php5.6-fpm-www1.sock" max_fails=0;
        server "unix:/run/php/php5.6-fpm-www2.sock" max_fails=0;
        server "unix:/run/php/php5.6-fpm-www3.sock" max_fails=0;
        server "unix:/run/php/php5.6-fpm-www4.sock" max_fails=0;
        server "unix:/run/php/php5.6-fpm-www5.sock" max_fails=0;

Then restart 2 service
/etc/init.d/php5.6-fpm restart
Systemctl restart nginx

26
ถ้าต้องการสร้าง tmux แล้วตั้งเป็นชื่อ session นี้
tmux new -s pklsession
tmux a -t pklsession

ทำการ kill ทุก session ยกเว้นเหลือไว้แค่ pklsession
tmux kill-session -a -t pklsession

27
==== อีกตัวอย่าง จะทำการเปลี่ยน folder หลักและ sub-folder ภายใน folder หลักด้วย =====
find /home/test/public_html/wp-admin -type d -exec chmod 755 {} \;
หรือจะ
cd /home/test/public_html/wp-admin
find . -type d -exec chmod 755 {} \;

To change all the files to 644 (-rw-r--r--):
find /opt/lampp/htdocs -type f -exec chmod 644 {} \;

Some splainin': (thanks @tobbez)

chmod 755 {} specifies the command that will be executed by find for each directory
chmod 644 {} specifies the command that will be executed by find for each file
{} is replaced by the path
; the semicolon tells find that this is the end of the command it's supposed to execute
\; the semicolon is escaped, otherwise it would be interpreted by the shell instead of find

28
===สคิป find folder then chmod folder 755 and file 644 in wordpress
find /home/wordpress/htdocs \
\( -type f -exec chmod ug+rw,o+r {} \; \) , \
\( -type d -exec chmod ug+rwxs,o+rx {} \; \)

29
tmux ดู output เก่าที่รันไปแล้ว
ctrl+b+[
แล้วเลื่อนลูกศร ขึ้นไปเรื่อยๆ  8)

30
ถ้าไม่สามารถแจ้งเมลไปให้ยัง gmail.com ได้ และต้องการแอด IP เพื่อเป็น whitelist ในระบบของ Gmail.com สามารถทำได้ดังนี้
1.Log in to https://admin.google.com and click Apps.
2.Click Google Workspace.
3.Click Gmail.
4.Click Spam, Phishing and Malware. ...
5.Under the Organizational Unit section, highlight your domain. ...
6.In the Email whitelist section, enter our IP addresses separated by commas. ...
7.Click Save.

ก็จะสามารถทำให้ ส่งอีเมลจาก ip ที่เราแจ้งไว้ได้
*** แต่ต้องตรวจสอบให้ดีว่า ip เราจะไม่ส่งพวกสแปมอีเมลมาหา gmail.com ด้วยนะครับ ***  ;)

Pages: 1 [2] 3 4 ... 146