免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: hhx012
打印 上一主题 下一主题

[系统管理] /etc/rc.d/rc.load无法执行程序 [复制链接]

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
11 [报告]
发表于 2015-04-21 10:08 |只看该作者
另外,你在shell提示符下执行你的那个sh脚本,有结果没有

论坛徽章:
0
12 [报告]
发表于 2015-04-21 11:25 |只看该作者
改为绝对路径可以开机执行了,谢谢
回复 10# chenyx


   

论坛徽章:
0
13 [报告]
发表于 2015-04-21 11:32 |只看该作者
这是我第一个脚本,可以正常开机启动了,第二个脚本又有问题了

[root@localhost ~]# cat /bin/t2.sh
#!/bin/bash
while /usr/local/bin/inotifywait -e modify /bin/t3.txt
do
if tail -n1 /bin/t3.txt | grep DELETE;then
tail -n1 /bin/t3.txt | grep DELETE >> /bin/filelogdelete.txt && lsof | grep smbd | grep 192.168.100. | awk '{print $9}' | cut -d ":" -f 2 | cut -d ">" -f 2 >> /bin/filelogdelete.txt
elif tail -n1 /bin/t3.txt | grep CREATE;then
tail -n1 /bin/t3.txt | grep CREATE >> /bin/filelogcreate.txt && lsof | grep smbd | grep 192.168.100. | awk '{print $9}' | cut -d ":" -f 2 | cut -d ">" -f 2 >> /bin/filelogcreate.txt
elif tail -n1 /bin/t3.txt | grep MODIFY;then
tail -n1 /bin/t3.txt | grep MODIFY >> /bin/filelogmodify.txt && lsof | grep smbd | grep 192.168.100. | awk '{print $9}' | cut -d ":" -f 2 | cut -d ">" -f 2 >> /bin/filelogmodify.txt
elif tail -n1 /bin/t3.txt | grep MOVED_FROM;then
tail -n1 /bin/t3.txt | grep MOVED_FROM >> /bin/filelogmovedform.txt && lsof | grep smbd | grep 192.168.100. | awk '{print $9}' | cut -d ":" -f 2 | cut -d ">" -f 2 >> /bin/filelogmovedform.txt
elif tail -n1 /bin/t3.txt | grep MOVED_TO;then
tail -n1 /bin/t3.txt | grep MOVED_TO >> /bin/filelogmovedto.txt && lsof | grep smbd | grep 192.168.100. | awk '{print $9}' | cut -d ":" -f 2 | cut -d ">" -f 2 >> /bin/filelogmovedto.txt
fi
done


也是开机不能自动执行,刚开始的时候脚本里面是相对路径,现在改成绝对路径,也不可以。在shell下可以正常执行。

[root@localhost ~]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
echo 8192000 >> /proc/sys/fs/inotify/max_user_watches
/bin/t1.sh
/bin/t2.sh &

回复 11# chenyx


   

论坛徽章:
0
14 [报告]
发表于 2015-04-27 16:38 |只看该作者
版主,我的问题有时间帮我看看吗。

回复 11# chenyx


   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP