Recent Posts

Pages: 1 2 [3] 4 5 ... 10
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
« Last post by golfreeze 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
« Last post by golfreeze 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 5 ... 10