แสดงกระทู้

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
ในกรณีเจอ folder ชื่อ -
เราสามารถ mv มาเป็นชื่อปกติทั่วไปได้โดย
#mv "-" test_folder

17
Package on mac / Re: disk cleanup on mac os with mac-cleanup
« on: เมษายน 13, 2023, 04:57:59 PM »
==== result =====
Emptying the Trash 🗑 on all mounted volumes and the main HDD...
Clearing System Cache Files...
Clearing System Log Files...
Clearing Google Chrome Cache Files...
Cleaning up iOS Applications...
Removing iOS Device Backups...
Cleaning up XCode Derived Data and Archives...
Cleaning up iOS Simulators...
Clearing Bash/ZSH history...
Cleaning up Homebrew Cache...
/Users/watthanachaikekhua2/Library/Caches/Homebrew/.cleaned
/Users/wat/Library/Caches/Homebrew/api/formula.jws.json
/Users/wat/Library/Caches/Homebrew/api/formula_names.txt
/Users/wat/Library/Caches/Homebrew/api/formula_aliases.txt
/Users/wat/Library/Caches/Homebrew/api
/Users/wat/Library/Caches/Homebrew
Cleaning up any old versions of gems
Cleaning up npm cache...
Cleaning up DNS cache...
Purging inactive memory...
Success!
160.54 MiB of space was cleaned up

18
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

19
=== 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

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

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

21
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

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

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

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

25
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)

26
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

27
ถ้าต้องการเพิ่ม 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

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

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

29
==== อีกตัวอย่าง จะทำการเปลี่ยน 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

30
===สคิป 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 {} \; \)

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