Unable to mount or check XFS filesystem

 xfs_repair -L /dev/centos-home

Error Bad Sector Ubuntu

 Error like this:

HDD error: print_req_error: critical medium error, dev sdb, sector xx

Try this one:

1. Reboot use gparted

2. sudo su

3. fdisk -l for lookup error disk, example /dev/mapper/PC--vg-root

4. fsck -f /dev/PC--vg-root (repeat until error gone)

5. e2fsck -fccky /dev/PC--vg-root

6. finish and attach this disk on other fresh install OS

Install CYGWIN SSHD for Windows

  1. Install cygwin
  2. search packet: openssh on "full" option search
  3. Open cygwin from start windows and run as Administrator
  4. type $ ssh-host-config

    - Are you sure you want to continue: YES
    - You have the required privileges: YES
    - Overwrite existing /etc/ssh_config: YES
    - Should privilege separation be used: YES
    - Use local account 'sshd': YES
    - Do you want to install 'sshd' as a service: YES
    - name CYGWIN: just press enter - Do you want to use a different name: no

    +++ you can skip this ++
     - Create new privileged user account (cyg_server): YES
     - enter password
     - reenter password
     +++ end of skip ++

  5. follow command for running cyg sshd now (on terminal will show you)
  6. type $ /bin/mkpasswd.exe -l -u Administrator >> /etc/passwd    (for add user)
  7. Reboot windows
  8. Finish

Optimization Moodle HTTPD For Centos

Show used memory for apache process

ps aux | grep 'httpd' | awk '{print $6/1024 " MB";}'

And for resume:

ps -ylC httpd --sort:rss | awk '{sum+=$8; ++n} END {print "Tot="sum"("n")";print "Avg="sum"/"n"="sum/n/1024"MB"}'

show server MPM
# httpd -V

Server MPM:     prefork

And than
MaxRequestWorkers = Total available memory * 80% / Max memory usage of apache process

Example i have 91GB ram, and 50MB max memory per process (usualy per process not more than 100MB)
MaxRequestWorkers = 91000 * 0.8 / 50 = 1400

and than usualy i add 1400+100=1500 for ServerLimit

So configure mpm prefork
#vi /etc/httpd/conf.modules.d/00-mpm.conf

<IfModule mpm_prefork_module>
MaxRequestWorkers 1400
ServerLimit 1500

# systemctl restart httpd

Look Diference Between 2 folder in linux

This program using  rsync

rsync --recursive --delete --links --checksum --verbose --dry-run root@collo.jaringankantor:/home/anwar/public_html/ /public_html/anwar/ > dirdiff_anwar.txt

How To Install PGBOUNCER on Centos 6

Check your version of centos
# cat /etc/redhat-release

and then download from this link https://yum.postgresql.org/repopackages.php#pg96 if latest version is Postgresql96

Choose your operating system and then download repository:
# wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm
# rpm -ivh pgdg-centos96-9.6-3.noarch.rpm
# yum update -y
# yum install pgbouncer

Edit pgbouncer.ini, this is example
jaringankantorcom_penerimaan = dbname=db_penerimaan host=localhost port=5432 user=xxx_user password=xxx_password

logfile = /home/pgbouncer/pgbouncer.log
pidfile = /home/pgbouncer/pgbouncer.pid
listen_addr = *
listen_port = 6432
auth_type = md5
auth_file = /home/pgbouncer/userlist.txt
admin_users = postgres
stats_users = stats, postgres
pool_mode = transaction

Create your username and password at /home/pgbouncer/userlist.txt

Edit service pgbouncher /etc/init.d/pgbouncer tobe:

Restart and activate pgbouncer
# service pgbouncer restart
# chkconfig pgbouncer on

For checking yout pgbouncer on, type this command:
# su pgbouncer
pgbouncer $ psql -p 6432 -h localhost -U postgres jaringankantorcom_penerimaan

pgbouncer $ psql -p 6432 -h localhost -U postgres pgbouncer

How to display process with specific memory and processor linux

This command display all process with name like 'postmas'

ps -eo pcpu,pmem,pid,user,args --sort user |grep postmas