Apache定时开启和关闭


Apache定时开启和关闭


#!/bin/bash

b=`pgrep httpd`

if [[ $b != "" ]];then
    service httpd stop
else
    service httpd start
fi

使用crontab:


0 8,18 * * * sh /root/apache.sh

发表回复