查看进程

[root@umsmaster ~]# ps -aef |grep postmaster
postgre   2680     1  0 08:25 ?        00:00:01 /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
root     20661 19348  0 13:59 pts/2    00:00:00 grep postmaster
[root@umsmaster ~]# ps -aef |grep postmaster |grep -v grep
postgre   2680     1  0 08:25 ?        00:00:01 /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
[root@umsmaster ~]# ps -aef |grep postmaster |grep -v grep|awk '{print $2}'

2680



#!/bin/sh


check=`ps -aef |grep postmaster |grep -v grep|awk '{print $2}' `


if [ "$check" = "" ];then


  exit 0


fi


  exit 1



你可能感兴趣的:(查看进程)