***********************************
# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
***********************************
Solution:
Comment out listen 80 in your /etc/httpd/conf/httpd.conf or /ect/apache2/ports.conf, it depends on your linux distro. try to use "locate" command.
example:
#Listen 80
IfModule mod_ssl.c
Listen 443
IfModule
Sunday, November 8, 2009
Kill process in Linux or terminate a process in UNIX or Linux systems
Q. How do I kill process in Linux?
A. Linux and all other UNIX like oses comes with kill command. The command kill sends the specified signal (such as kill process) to the specified process or process group. If no signal is specified, the TERM signal is sent.
Kill process using kill command under Linux/UNIX
kill command works under both Linux and UNIX/BSD like operating systems.
Step #1: First, you need to find out process PID (process id)
Use ps command or pidof command to find out process ID (PID). Syntax:
ps aux | grep processname
pidof processname
For example if process name is lighttpd, you can use any one of the following command to obtain process ID:
# ps aux | grep lighttpd
Output:
OR use pidof command which is use to find the process ID of a running program:
# pidof lighttpd
Output:
3486
Step #2: kill process using PID (process id)
Above command tell you PID (3486) of lighttpd process. Now kill process using this PID:
# kill 3486
OR
# kill -9 3486
Where,
killall command examples
DO NOT USE killall command on UNIX system (Linux only command). You can also use killall command. The killall command kill processes by name (no need to find PID):
# killall -9 lighttpd
Kill Firefox process:
# killall -9 firefox-bin
As I said earlier killall on UNIX system does something else. It kills all process and not just specific process. Do not use killall on UNIX system (use kill -9).
* -9 is special Kill signal, which will kill the process.
Source
A. Linux and all other UNIX like oses comes with kill command. The command kill sends the specified signal (such as kill process) to the specified process or process group. If no signal is specified, the TERM signal is sent.
Kill process using kill command under Linux/UNIX
kill command works under both Linux and UNIX/BSD like operating systems.
Step #1: First, you need to find out process PID (process id)
Use ps command or pidof command to find out process ID (PID). Syntax:
ps aux | grep processname
pidof processname
For example if process name is lighttpd, you can use any one of the following command to obtain process ID:
# ps aux | grep lighttpd
Output:
lighttpd 3486 0.0 0.1 4248 1432 ? S Jul31 0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
lighttpd 3492 0.0 0.5 13752 3936 ? Ss Jul31 0:00 /usr/bin/php5-cg
OR use pidof command which is use to find the process ID of a running program:
# pidof lighttpd
Output:
3486
Step #2: kill process using PID (process id)
Above command tell you PID (3486) of lighttpd process. Now kill process using this PID:
# kill 3486
OR
# kill -9 3486
Where,
killall command examples
DO NOT USE killall command on UNIX system (Linux only command). You can also use killall command. The killall command kill processes by name (no need to find PID):
# killall -9 lighttpd
Kill Firefox process:
# killall -9 firefox-bin
As I said earlier killall on UNIX system does something else. It kills all process and not just specific process. Do not use killall on UNIX system (use kill -9).
* -9 is special Kill signal, which will kill the process.
Source
Show All Running Processes in Linux
How do I see all running process in Linux?
You need to use the ps command. It provide information about the currently running processes, including their process identification numbers (PIDs). Both Linux and UNIX support ps command to display information about all running process. ps command gives a snapshot of the current processes. If you want a repetitive update of this status, use top command.
Task: Use ps command
Type the following ps command to display all running process
Where,
* -A: select all processes
* a: select all processes on a terminal, including those of other users
* x: select processes without controlling ttys
Task: see every process on the system
Task: See every process except those running as root
Task: See process run by user vivek
Task: Use top command
The top program provides a dynamic real-time view of a running system. Type the top at command prompt:
Output:

To quit press q, for help press h.
Task: display a tree of processes
pstree shows running processes as a tree. The tree is rooted at either pid or init if pid is omitted. If a user name is specified, all process trees rooted at processes owned by that user are shown.
Output:
Task: Print a process tree using ps
Task: Get info about threads
Task: Get security info
Task: Save Process Snapshot to a file
Or you can email it to yourself:

Task: Lookup process
Use pgrep command. pgrep looks through the currently running processes and lists the process IDs which matches the selection criteria to screen. For example display firefox process id:
Following command will list the process called sshd which is owned by root user.
Say hello to htop
htop is interactive process viewer just like top, but allows to scroll the list vertically and horizontally to see all processes and their full command lines. Tasks related to processes (killing, renicing) can be done without entering their PIDs. To install htop type command:
or
Now type htop to run the command:

(click to enlarge)
You need to use the ps command. It provide information about the currently running processes, including their process identification numbers (PIDs). Both Linux and UNIX support ps command to display information about all running process. ps command gives a snapshot of the current processes. If you want a repetitive update of this status, use top command.
Task: Use ps command
Type the following ps command to display all running process
# ps aux | less
Where,
* -A: select all processes
* a: select all processes on a terminal, including those of other users
* x: select processes without controlling ttys
Task: see every process on the system
# ps -A
# ps -e
Task: See every process except those running as root
# ps -U root -u root -N
Task: See process run by user vivek
# ps -u vivek
Task: Use top command
The top program provides a dynamic real-time view of a running system. Type the top at command prompt:
# top
Output:

To quit press q, for help press h.
Task: display a tree of processes
pstree shows running processes as a tree. The tree is rooted at either pid or init if pid is omitted. If a user name is specified, all process trees rooted at processes owned by that user are shown.
$ pstree
Output:
Task: Print a process tree using ps
# ps -ejH
# ps axjf
Task: Get info about threads
# ps -eLf
# ps axms
Task: Get security info
# ps -eo euser,ruser,suser,fuser,f,comm,label
# ps axZ
# ps -eM
Task: Save Process Snapshot to a file
# top -b -n1 > /tmp/process.log
Or you can email it to yourself:
# top -b -n1 | mail -s 'Process snapshot' you@example.com

Task: Lookup process
Use pgrep command. pgrep looks through the currently running processes and lists the process IDs which matches the selection criteria to screen. For example display firefox process id:
$ pgrep firefox
Following command will list the process called sshd which is owned by root user.
$ pgrep -u root sshd
Say hello to htop
htop is interactive process viewer just like top, but allows to scroll the list vertically and horizontally to see all processes and their full command lines. Tasks related to processes (killing, renicing) can be done without entering their PIDs. To install htop type command:
# apt-get install htop
or
# yum install htop
Now type htop to run the command:
# htop

(click to enlarge)
Monday, October 26, 2009
Limit the number of selected checkboxes in javascript
If you have multiple checkboxes:
Html Code
You can get the count using this:
JavaScript Code:
Html Code
You can get the count using this:
JavaScript Code:
var cnt=0
function check(obj,maxs){
if(obj.checked){
cnt=cnt+1
}else{
cnt=cnt-1
}
if (cnt>maxs){
obj.checked=false
cnt=cnt-1
alert('Can only select up to '+maxs)
}
}
Change Ubuntu Server from DHCP to a Static IP Address
If the Ubuntu Server installer has set your server to use DHCP, you will want to change it to a static IP address so that people can actually use it.
Changing this setting without a GUI will require some text editing, but that’s classic linux, right?
Let’s open up the /etc/network/interfaces file. I’m going to use vi, but you can choose a different editor
sudo vi /etc/network/interfaces
For the primary interface, which is usually eth0, you will see these lines:
auto eth0
iface eth0 inet dhcp
As you can see, it’s using DHCP right now. We are going to change dhcp to static, and then there are a number of options that should be added below it. Obviously you’d customize this to your network.
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
Now we’ll need to add in the DNS settings by editing the resolv.conf file:
sudo vi /etc/resolv.conf
On the line ‘name server xxx.xxx.xxx.xxx’ replace the x with the IP of your name server. (You can do ifconfig /all to find out what they are)
You need to also remove the dhcp client for this to stick (thanks to Peter for noticing). You might need to remove dhcp-client3 instead.
sudo apt-get remove dhcp-client
Now we’ll just need to restart the networking components:
sudo /etc/init.d/networking restart
Ping www.google.com. If you get a response, name resolution is working(unless of course if google is in your hosts file).
Source
Changing this setting without a GUI will require some text editing, but that’s classic linux, right?
Let’s open up the /etc/network/interfaces file. I’m going to use vi, but you can choose a different editor
sudo vi /etc/network/interfaces
For the primary interface, which is usually eth0, you will see these lines:
auto eth0
iface eth0 inet dhcp
As you can see, it’s using DHCP right now. We are going to change dhcp to static, and then there are a number of options that should be added below it. Obviously you’d customize this to your network.
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
Now we’ll need to add in the DNS settings by editing the resolv.conf file:
sudo vi /etc/resolv.conf
On the line ‘name server xxx.xxx.xxx.xxx’ replace the x with the IP of your name server. (You can do ifconfig /all to find out what they are)
You need to also remove the dhcp client for this to stick (thanks to Peter for noticing). You might need to remove dhcp-client3 instead.
sudo apt-get remove dhcp-client
Now we’ll just need to restart the networking components:
sudo /etc/init.d/networking restart
Ping www.google.com. If you get a response, name resolution is working(unless of course if google is in your hosts file).
Source
Friday, October 23, 2009
Ubuntu 8.04 (Hardy Heron) LAMP Server Setup
Please visit this link for the full documentation:
http://www.scribd.com/doc/21499447/Installing-Ubuntu-8?secret_password=14l3jve0xyocuoimryor
http://www.scribd.com/doc/21499447/Installing-Ubuntu-8?secret_password=14l3jve0xyocuoimryor
Subscribe to:
Posts (Atom)