Find the answer to your Linux question:
Results 1 to 5 of 5
Hi folks, ubuntu-6.06-LAMP-server-amd64 Instead of running; $ sudo /etc/init.d/mysql status $ sudo /etc/init.d/apache2 status etc. respectively. to find out whether they are running. Is there a simple command to list ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,804

    a simple command


    Hi folks,

    ubuntu-6.06-LAMP-server-amd64

    Instead of running;
    $ sudo /etc/init.d/mysql status
    $ sudo /etc/init.d/apache2 status
    etc. respectively.

    to find out whether they are running. Is there a simple command to list the status of all applications collectively.

    $ ps aux
    lists all prcocesses which is not an ideal command for my application.

    TIA

    B.R.
    satimis

  2. #2
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    How about:

    Code:
    ps -ef | egrep 'mysql|apache2|etc|etc'
    You're going to need to tweak those egrep patterns to be more precise, though. You can pipe the output of ps -ef to the less pager to figure out exactly what the daemons look like when running.

  3. #3
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,804
    Hi anomie,

    Tks for your advice.

    How about:

    Code:
    ps -ef | egrep 'mysql|apache2|etc|etc'
    $ ps -ef | egrep 'mysql|apache2|postfix'
    Code:
    root      4022     1  0 13:56 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe
    mysql     4086  4022  0 13:56 ?        00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
    root      4087  4022  0 13:56 ?        00:00:00 logger -p daemon.err -t mysqld_safe -i -t mysqld
    satimis   4937  4897  0 14:09 pts/2    00:00:00 grep -E mysql|apache2|postfix
    Yes. But it is not easy to identify the pid of mysql and mysql_sate respectively

    $ ps -A | grep mysql
    Code:
     4022 ?        00:00:00 mysqld_safe
     4086 ?        00:00:00 mysqld
    Others noted with tks.

    B.R.
    satimis

  4. #4
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    If you need to see the column identifier line (to tell which is the PID), then just do
    Code:
    ps -ef | egrep 'PID|mysql|apache2|postfix'
    edit: I also want to remind you that you're going to have to tweak what you're egrep-ing for (based on what the daemons run as). You won't be able to use my command verbatim.

  5. #5
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,804
    Quote Originally Posted by anomie
    If you need to see the column identifier line (to tell which is the PID), then just do
    Code:
    ps -ef | egrep 'PID|mysql|apache2|postfix'
    edit: I also want to remind you that you're going to have to tweak what you're egrep-ing for (based on what the daemons run as). You won't be able to use my command verbatim.
    Noted with tks.

    B.R.
    satimis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •