特定のコマンドが実行されているか調べる
#!/bin/sh #lsdaemon.sh DAEMONS="cron crond cupsd inetd lpd named nmbd ntpd smbd sshd syslogd xinted" PSCMD="ps axcww" for daemon in $DAEMONS; do out=`$PSCMD | grep "\\<${daemon}\\>"` if [ -n "$out" ]; then status="RUNNING" else status="not found" fi printf "%-16s %s\n" "$daemon" "$status" done