LoginSignup
0
1

More than 5 years have passed since last update.

Linuxシェル -- 踏み台などで他のApacheの起動状態を取得する例

Last updated at Posted at 2017-05-25

以下に、記述。

#!/bin/bash

ssh -o ConnectTimeout=2 linux_user@your_server ps -lef | grep ' apache ' | grep '/usr/sbin/httpd' > /tmp/check_apache_run.txt

if [ -s /tmp/check_apache_run.txt ]; then
  echo "FILE SIZE != 0" 
  echo "Yourサーバー(Apache) ok" >> /tmp/check_apache_run_report.txt
else
  echo "FILE SIZE = 0" 
  echo "Yourサーバー(Apache) 【停止】状態" >> /tmp/check_apache_run_report.txt
fi

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1