Posts

Showing posts from April, 2017

kill all processes by process name - kill $(ps -ef | grep processname | awk '{print $2}'

kill $(ps -ef | grep processname | awk '{print $2}' [root@localhost ~]# ps aux | grep sleep | grep -v grep | awk '{print $2}' 6631 6632 6633 6634 6635 6636 [root@localhost ~]# kill $(ps aux | grep sleep | grep -v grep | awk '{print $2}') [root@localhost ~]# ps aux | grep sleep | grep -v grep | awk '{print $2}' [1]   Terminated              sleep 600 [2]   Terminated              sleep 600 [3]   Terminated              sleep 600 [4]   Terminated              sleep 600 [5]-  Terminated              sleep 600 [6]+  Terminated              sleep 600 [root@localhost ~]# ps aux | grep sleep | grep -v grep | awk '{print $2}' [root@localhost ~]# ps aux | grep -i csp_build | awk '{print $2}' | xargs sudo kill -9

find top cpu consumer ps -eo pcpu,pid,user,args | sort -r -k1 | less

ps -eo pcpu,pid,user,args | sort -r -k1 | less

option to run long command /

mongo \ --ssl \ --sslCAFile path_to_server_pem \ --sslPEMKeyFile path_to_client_pem \ --sslPEMKeyPassword pem_key_passphrase \ --host mongodb_server_private_ip \ --port 28018

system.d unit systemctl daemon-reload

Наша компания занимается администрированием веб-серверов на базе CentOS. Довольно часто наши клиенты используют веб-приложения на базе python, ruby или java. Для автозапуска подобных приложений есть готовые шаблоны для написания стартап-скриптов. Но прогресс не стоит на месте, вышел уже второй релиз CentOS 7 и, следуя старой традиции «не ставить dot-zero релизы на продакшен», мы начинаем предлагать клиентам сервера на базе CentOS 7.1 (1503). В CentOS7, так же как и в его родителе RHEL7, используется systemd — менеджер системы и служб для Linux, совместимый со скриптами инициализации SysV и LSB. systemd обеспечивает возможности агрессивной параллелизации и много всего прочего. Systemd запускает сервисы описанные в его конфигурации. Конфигурация состоит из множества файлов, которые по-модному называют юнитами. Все эти юниты разложены в трех каталогах: /usr/lib/systemd/system/  – юниты из установленных пакетов RPM — всякие nginx, apache, mysql и прочее /run/systemd/system/  — ...

su su- sudo

su su- sudo su - logs you in completely as root, whereas su makes it so you are pretending to be root. The hyphen has two effects: 1) switches from the current directory to the home directory of the new user (e.g., to /root in the case of the root user) by logging in as that user 2) changes the environmental variables to those of the new user as dictated by their ~/.bashrc. That is, if the first argument to su is a hyphen, the current directory and environment will be changed to what would be expected if the new user had actually logged on to a new session (rather than just taking over an existing session). su -  invokes a login shell after switching the user. A login shell resets most environment variables, providing a clean base. su  just switches the user, providing a normal shell with an environment nearly the same as with the old user. Imagine, you're a software developer with normal user access to a machine and your ignorant admin...

xfs zfs ext4

ZFS is the only choice for reliability. Its one drawback is that it doesn't like RAID controllers, as it handles its own redundancy, so you have to use JBOD which may disable caching on some RAID controllers (example: 3ware), or single drive volumes. EXT4 has a 16 TiB limit, unless running on a 64 bit Linux system, and the EXT4 volume was created with the "64bit" feature flag which enlarges the inodes. ------------------ XFS  was more fragile , but the issue seems to be fixed. XFS was surely a slow-FS on metadata operations, but it  has been fixed  recently as well. EXT4 is still getting quite critical fixes as it follows from commits at kernel.org's git. " EXT4 does not support concurrent writes, XFS does " (But) EXT4 is more "mainline" ----------------- Ext4 Ext4 stands for fourth extended file system. It was introduced in 2008. Starting from Linux Kernel 2.6.19 ext4 was available. Supports huge individual file size and ov...

teamcity basic workflow

simple build lifecycle. The TeamCity server detects a change in your VCS Root and  stores it in the database. The build trigger sees the change in the database and adds a build to the queue. The server finds an idle compatible build agent and assigns the queued build to this agent. The agent executes the  Build Steps. While the build steps are being executed, the build agent reports the build progress to the TeamCity server sending all the log messages, test reports, code coverage results, etc. to the server on the fly, so you can monitor the build process in real time. After finishing the build, the build agent sends  Build Artifacts  to the server. 

runuser sudo su

Image
You can use the following commands to run as another user or as root user. #1: runuser command The runuser command run a shell with substitute user and group IDs. This command is  useful only when run as the root user : Only session PAM hooks are run, and there is no password prompt. If run as a non-root user without privilege to set user ID, the command will fail as the binary is not setuid. As runuser doesn’t run auth and account PAM hooks, it runs with lower overhead than su. The syntax is: runuser -l userNameHere -c 'command' runuser -l userNameHere -c '/path/to/command arg1 arg2' For example, as a root user you may want to check shell resource limits for oracle user, enter: # runuser -l oracle -c 'ulimit -SHa' OR check nginx or lighttpd web server limitations: # runuser -l nginx -c 'ulimit -SHa' OR # runuser -l lighttpd -c 'ulimit -SHa' Sometime, a root user can not browse NFS mounted share due to permission (secur...

install nexus

sudo tar xvzf nexus-latest-bundle.tar.gz sudo groupadd nexus sudo chown -hR nexus:nexus nexus #chown ldap. /var/lib/ldap/DB_CONFIG #chown ldap:ldap /var/lib/ldap/DB_CONFIG sudo -u nexus ./bin/nexus start tail -f logs/wrapper.log  http://127.0.0.1:8081/nexus/#welcome

install chrome on centos

Open the Terminal application. Grab 64bit Google Chrome. Type the following command to  download 64 bit version  of Google Chrome: wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm Install Google Chrome and its dependencies on a CentOS/RHEL, type: sudo yum install ./google-chrome-stable_current_*.rpm Start Google Chrome from the CLI: google-chrome & option #2 Enable Google YUM repository Add following to  /etc/yum.repos.d/google.repo  file: 32-bit [ google ] name =Google - i386 baseurl =http: // dl.google.com / linux / rpm / stable / i386 enabled = 1 gpgcheck = 1 gpgkey =https: // dl-ssl.google.com / linux / linux_signing_key.pub 64-bit [ google64 ] name =Google - x86_64 baseurl =http: // dl.google.com / linux / rpm / stable / x86_64 enabled = 1 gpgcheck = 1 gpgkey =https: // dl-ssl.google.com / linux / linux_signing_key.pub Note: Both 32-bit and 64-bit repos can be placed in the same file. Install ...