设为首页
收藏本站
用户名
Email
自动登录
找回密码
密码
登录
注册
快捷导航
平台
Portal
论坛
BBS
文库
项目
群组
Group
我的博客
Space
搜索
搜索
热搜:
shell
linux
mysql
本版
用户
LinuxSir.cn,穿越时空的Linuxsir!
»
论坛
›
Linux 综合讨论区 —— LinuxSir.cn
›
shell进阶应用、shell编程
›
虽然看了论坛大量的crontab问题,但是都没有能解决问题, ...
1
2
/ 2 页
下一页
返回列表
查看:
1454
|
回复:
16
虽然看了论坛大量的crontab问题,但是都没有能解决问题,只好在重新发布一下
[复制链接]
xinkeren
xinkeren
当前离线
积分
22
IP卡
狗仔卡
发表于 2004-5-30 12:59:38
|
显示全部楼层
|
阅读模式
有一台远程adsl上网机器装(rh9),想知道每天的ip是多少写了一个简单脚本
root#cat mail.sh
#!/bin/bash
PATH=/sbin:/usr/sbin/bin:/bin:
ifconfig -a |grep 'ppp0'/tmp/ip.txt
dt=`date +*%d-%m-%y`
mail -s ip$dt ****@hotmail.com <ip.txt
rm -r /tmp/ip.txt
放入cron
cat /root/root.cron
00 13 * * * * root /root/mail.sh
crontab -l 可以看到cron
crond已经运行了
runlevel是3
但是crontab就是不执行!!!!有些急了在rh7.2上执行也不行,以前没有问题???
请高手解决一下!!!
回复
使用道具
举报
提升卡
置顶卡
沉默卡
喧嚣卡
变色卡
显身卡
KornLee
KornLee
当前离线
积分
6960
IP卡
狗仔卡
发表于 2004-5-30 13:19:10
|
显示全部楼层
使用cron服务需要主意的几点:
1,确保crontab服务正常运行
用service crond status检查一下,用chkconfig atd on启动
2,检查/etc/cron.allow和/etc/cron.deny文件,看是否被禁用
3,root用户所用的配置文件跟普通用户的不一样,他通常在
/etc/crontab而普通用户的是放在/var/spool/cron下
4,确保正确的语法格式
crontab的详细解释,见:
http://www.linuxsir.cn/forum.php?mod=viewthread&tid=5115
回复
支持
反对
使用道具
举报
显身卡
xinkeren
xinkeren
当前离线
积分
22
IP卡
狗仔卡
楼主
|
发表于 2004-5-30 13:33:10
|
显示全部楼层
这个论坛的编辑功能在那里啊
atd是stop的
现在我已经启动了atd是个什么守护进程????
cron正在测试能不能行!!
回复
支持
反对
使用道具
举报
显身卡
KornLee
KornLee
当前离线
积分
6960
IP卡
狗仔卡
发表于 2004-5-30 13:37:45
|
显示全部楼层
sorry,应该是crond这个守护进程 :sorry
回复
支持
反对
使用道具
举报
显身卡
xinkeren
xinkeren
当前离线
积分
22
IP卡
狗仔卡
楼主
|
发表于 2004-5-30 13:46:52
|
显示全部楼层
crontab还是没有做动作
到底是为什么呢?
回复
支持
反对
使用道具
举报
显身卡
KornLee
KornLee
当前离线
积分
6960
IP卡
狗仔卡
发表于 2004-5-30 13:50:58
|
显示全部楼层
我做的实验:
1,生成/var/spool/cron/root
50 13 * * * root >/root/$(date +%F)file
2,启动cornd服务
/root#service crond restart
停止 crond: [ 确定 ]
启动 crond:
3, 检查root目录:
/root#ls
anaconda-ks.cfg install.log install.log.syslog
4,指定时间后检查root目录:
/root#ls
2004-05-30file
anaconda-ks.cfg install.log install.log.syslog
生效!
回复
支持
反对
使用道具
举报
显身卡
xinkeren
xinkeren
当前离线
积分
22
IP卡
狗仔卡
楼主
|
发表于 2004-5-30 13:55:24
|
显示全部楼层
再次感谢javelee的热心回复
因为我看过你过去对此问题的解答所以,你的以上步骤我都做过了,在这两台机器上,但是我的cron 没有动作
回复
支持
反对
使用道具
举报
显身卡
KornLee
KornLee
当前离线
积分
6960
IP卡
狗仔卡
发表于 2004-5-30 13:59:06
|
显示全部楼层
回复: 再次感谢javelee的热心回复
最初由 xinkeren 发表
因为我看过你过去对此问题的解答所以,你的以上步骤我都做过了,在这两台机器上,但是我的cron 没有动作
没有给你提供什么帮助!
:sorry
不果大致的步骤都差不多~,望多看这些命令的手册 :thank
回复
支持
反对
使用道具
举报
显身卡
xinkeren
xinkeren
当前离线
积分
22
IP卡
狗仔卡
楼主
|
发表于 2004-5-30 14:00:07
|
显示全部楼层
哦对不起后面的动作我没有做!
[root@legend cron]# /sbin/service crond retart
Usage: /etc/init.d/crond {start|stop|status|reload|restart|condrestart}
[root@legend cron]# /sbin/service crond restart
Stopping crond: OK ]
Starting crond: OK ]
[root@legend cron]# ls
root
[root@legend cron]# cat root
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (mm.cron installed on Sun May 30 13:36:53 2004)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
00 14 * * * * root /root/mail.sh
[root@legend cron]# cd /root
[root@legend root]# ls
anaconda-ks.cfg id.txt ip.txT mail.sh mm.txt rc.fire
Desktop ip mac.txt mm.cron nat.fire ss
[root@legend root]#
我的root下为什么只有一个anaconda-ks.cfg文件环境是rh7.2
回复
支持
反对
使用道具
举报
显身卡
xinkeren
xinkeren
当前离线
积分
22
IP卡
狗仔卡
楼主
|
发表于 2004-5-30 14:01:09
|
显示全部楼层
这是我按你的方法做的有什么错误吗
root@legend cron]# /sbin/service crond retart
Usage: /etc/init.d/crond {start|stop|status|reload|restart|condrestart}
[root@legend cron]# /sbin/service crond restart
Stopping crond: OK ]
Starting crond: OK ]
[root@legend cron]# ls
root
[root@legend cron]# cat root
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (mm.cron installed on Sun May 30 13:36:53 2004)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
00 14 * * * * root /root/mail.sh
[root@legend cron]# cd /root
[root@legend root]# ls
anaconda-ks.cfg id.txt ip.txT mail.sh mm.txt rc.fire
Desktop ip mac.txt mm.cron nat.fire ss
[root@legend root]#
我的root下为什么只有一个anaconda-ks.cfg文件环境是rh7.2
回复
支持
反对
使用道具
举报
显身卡
下一页 »
1
2
/ 2 页
下一页
返回列表
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
|
注册
本版积分规则
发表回复
回帖后跳转到最后一页
浏览过的版块
硬件设备 Linux 驱动
网络技术\网络安全讨论
LinuxSir 论坛管理
SuSE Linux
Ubuntu Linux 专题讨论
Linux发行版 Turbolinux专题
Debian Linux
Linux 基础讨论区(新手速成)
Archlinux讨论区
Copyright © 2002-2023
LinuxSir.cn
(http://www.linuxsir.cn/) 版权所有 All Rights Reserved.
Powered by
RedflagLinux!
技术支持:
中科红旗
|
京ICP备19024520号
快速回复
返回顶部
返回列表