Thứ Ba, 24 tháng 9, 2013

Determine PID and Linux Kill Command Examples

Use the kill command to send a signal to each process specified by a pid (process identifier). The default signal is SIGTERM (terminate the process).

Syntax

kill PID
kill -s signalName PID
kill -9 PID

Common UNIX Signal Names and Numbers

All available UNIX signals have different names, and are mapped to certain numbers as described below.
NumberNameDescriptionUsed for
0SIGNULLNullCheck access to pid
1SIGHUPHangupTerminate; can be trapped
2SIGINTInterruptTerminate; can be trapped
3SIGQUITQuitTerminate with core dump; can be
9SIGKILLKillForced termination; cannot be trapped
15SIGTERMTerminateTerminate; can be trapped
24SIGSTOPStopPause the process; cannot be trapped
25SIGTSTPTerminalstop Pause the process; can be
26SIGCONTContinueRun a stopped process
Note the specific mapping between numbers and signals can vary between Unix implementations, please see the manual page entry signal(5), by typing the following command:
man 5 signal

Examples: Send a Kill Single To Process ID 1414

Use the following command to kill pid 4242 and exit gracefully:
kill 4242
To find pid of any job or command use ps command:
ps | grep command
ps aux | grep command
ps aux | grep apache

The following all are equivalent commands with -9 SIGKIL (i.e forcefully kill 1414 process):

kill -s SIGKILL 1414
kill -s KILL 1414
kill -s 9 1414
kill -SIGKILL 1414
kill -KILL 1414

Find out or determine if process pid is running

The easiest way to find out is run ps aux command and grep process name. If you got output along with process name/pid, your process is running.

Task: Find out process pid

Simply use ps command as follows:
ps aux | grep {process-name}
For example find out if mysqld process (mysqld pid) is running or not:
$ ps aux | grep mysqld
Output:
mysql    28290  1.1  2.7 340496 56812 ?        Sl   Jul31 348:27 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --socket=/var/lib/mysql/mysql.sock

Find the process ID of a running program using pidof

pidof command finds the process id’s (pids) of the named programs. It prints those id’s on screen. This program is on some systems used in run level change scripts, especially when the system has a System-V like rc structure. In that case these scripts are located in /etc/rc?.d, where ? is the runlevel. If the system has a start-stop-daemon (8) program that should be used instead. # pidof mysqld Output:
28290

(cyberciti.biz)

Thứ Hai, 23 tháng 9, 2013

How to setup Kloxo

Kloxo là một chương trình Control Panel thuộc dạng Open Source, Kloxo miễn phí sử dụng cho 40 tên miền bạn sử dụng, sau đó bạn sẽ bị tính phí. Do vậy, nếu bạn chỉ chạy cho một vài tên miền trên VPS thì Kloxo là sự lựa chọn tiết kiệm nhất. Với nhiều tên miền hơn bạn hãy sử dụng DirectAdmin.

Để cài đặt Kloxo bạn cần đăng nhập bằng quyền root:

wget http://download.lxlabs.com/download/kloxo/production/kloxo-installer.sh
chmod 755  kloxo-installer.sh
./kloxo-installer.sh --type=master --version=6.1.9

Kloxo sẽ tự động download và cài đặt cho bạn những phần mềm sau:

Web server:
+ apache
+ pure-ftp
+ awstats

Mail server:
+ qmail-toaster
+ courier (imap pop)
+ webmail
+ httpd (for webmail)

Nameserver:
+ bind
+ bind-chroot
+ Database Server:
+ mysql-server


Sau khi cài đặt thành công, bạn có thể đăng nhập sử dụng bẳng http://IP:7778 hoặchttps://IP:7777 với user là admin và password là admin. Trong lần đăng nhập đầu tiên này bạn sẽ phải đổi password mới.

(appvz.com)