全球主机交流论坛

标题: 用了李院长的502重启脚本后,SSH中老提示我有邮件 [打印本页]

作者: wjhhxl    时间: 2011-4-15 17:38
标题: 用了李院长的502重启脚本后,SSH中老提示我有邮件
登录SSH,
有提示
You have new mail in /var/spool/mail/root


我去看那个文件,全都是,出现了很多次。

From root@centos  Fri Apr 15 14:19:01 2011
Return-Path: <root@centos>
Received: from centos (localhost.localdomain [127.0.0.1])
        by centos (8.13.8/8.13.8) with ESMTP id p3F6J1Jr028667
        for <root@centos>; Fri, 15 Apr 2011 14:19:01 +0800
Received: (from root@localhost)
        by centos (8.13.8/8.13.8/Submit) id p3F6J1G5028593;
        Fri, 15 Apr 2011 14:19:01 +0800
Date: Fri, 15 Apr 2011 14:19:01 +0800
Message-Id: <201104150619.p3F6J1G5028593@centos>
From: root@centos (Cron Daemon)
To: root@centos
Subject: Cron <root@centos> /root/phprestart
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

[ 本帖最后由 wjhhxl 于 2011-4-15 17:40 编辑 ]
作者: wjhhxl    时间: 2011-4-15 17:41
http://www.www.iloc.eu.org/viewthrea ... p;extra=&page=1
李院长502重启脚本贴子在此。
作者: xtmp    时间: 2011-4-15 17:42
>> /dev/null 2>&1

[ 本帖最后由 xtmp 于 2011-4-15 17:44 编辑 ]
作者: 李院长    时间: 2011-4-15 17:44
命令最后加上 > /dev/null 2>&1

时间.....    /....../xxx.sh  > /dev/null 2>&1
作者: wjhhxl    时间: 2011-4-15 17:45
原帖由 xtmp 于 2011-4-15 17:42 发表
>> /dev/null 2>&1


请问加在哪里
#!/bin/bash
#by [email protected]

MY_URL="http://www.xxx.net"
RESULT=`curl -I $MY_URL|grep "HTTP/1.1 502"`

if [ -n "$RESULT" ]; then
        #如果502则会执行这里的内容,随便加或改
        #reboot
        #...
        /usr/local/php/sbin/php-fpm restart
fi
作者: wjhhxl    时间: 2011-4-15 17:46
原帖由 李院长 于 2011-4-15 17:44 发表
命令最后加上 > /dev/null 2>&1

时间.....    /....../xxx.sh  > /dev/null 2>&1


是在crontab中加吗?
作者: xtmp    时间: 2011-4-15 17:47
加在定时crontab里啊
* * * * * root /bin/sh 重启脚本名.sh >> /dev/null 2>&1
作者: wjhhxl    时间: 2011-4-15 17:49
是   > /dev/null 2>&1
还是 >>/dev/null 2>&1
作者: wjhhxl    时间: 2011-4-15 17:50
*/3 * * * * /root/phprestart.sh  >> /dev/null 2>&1

我这样写吗?
作者: xtmp    时间: 2011-4-15 17:52
原帖由 wjhhxl 于 2011-4-15 17:50 发表
*/3 * * * * /root/phprestart.sh  >> /dev/null 2>&1

我这样写吗?

你原来怎么写的就怎么写,只是在末尾加上 >> /dev/null 2>&1
作者: wjhhxl    时间: 2011-4-15 17:55
标题: 回复 10# 的帖子
谢谢,不过我看到你7楼的代码中有
root /bin/sh
这几个字

我没有这些字
就是 */3 * * * * /root/phprestart.sh  >> /dev/null 2>&1
作者: 有个就好    时间: 2011-4-15 23:11
2个大于号




欢迎光临 全球主机交流论坛 (https://www.iloc.eu.org/) Powered by Discuz! X3.4