免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1503 | 回复: 6
打印 上一主题 下一主题

新装redhat9.0系统为何不能执行shell脚本? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-06-12 10:08 |只看该作者 |倒序浏览
这是我的proxy.shl脚本
route add -net 172.21.80.0 netmask 255.255.248.0 gw 172.21.81.2 eth0
/usr/sbin/squid -z
/usr/sbin/squid -f /etc/squid/squid.conf
service vsftpd start
echo 1 >; /proc/sys/net/ipv4/ip_forward
iptables -A POSTROUTING -t nat -s 172.21.81.0/24 -o eth1 -j SNAT --to-source 218.22.3.173

chmod +x proxy.sh为可执行.
可运行proxy.sh后出现一大堆错误。

但是如果我按照proxy.sh内容一句一句敲的话,可以执行,且不出错。
不知道有人遇到过这种情况没有,非常期待您的帮助!

论坛徽章:
0
2 [报告]
发表于 2005-06-12 10:10 |只看该作者

新装redhat9.0系统为何不能执行shell脚本?

请给出错误信息。

论坛徽章:
0
3 [报告]
发表于 2005-06-12 11:00 |只看该作者

新装redhat9.0系统为何不能执行shell脚本?

以下是错误信息:
SIOCADDRT: 没有那个设备
/usr/sbin/squid: invalid option --
Usage: squid [-dhsvzCDFNRVYX] [-f config-file] [-[au] port] [-k signal]
       -a port   Specify HTTP port number (default: 312.
       -d level  Write debugging to stderr also.
       -f file   Use given config-file instead of
                 /etc/squid/squid.conf
       -h        Print help message.
       -k reconfigure|rotate|shutdown|interrupt|kill|debug|check|parse
                 Parse configuration file, then send signal to
                 running copy (except -k parse) and exit.
       -s        Enable logging to syslog.
       -u port   Specify ICP port number (default: 3130), disable with 0.
       -v        Print version.
       -z        Create swap directories
       -C        Do not catch fatal signals.
       -D        Disable initial DNS tests.
       -F        Don't serve any requests until store is rebuilt.
       -N        No daemon mode.
       -R        Do not set REUSEADDR on port.
       -S        Double-check swap during rebuild.
       -V        Virtual host httpd-accelerator.
       -X        Force full debugging.
       -Y        Only return UDP_HIT or UDP_MISS_NOFETCH during fast reload.
: (2) No such file or directorytion file: /etc/squid/squid.conf
Squid Cache (Version 2.5.STABLE1): Terminated abnormally.
CPU Usage: 0.010 seconds = 0.000 user + 0.010 sys
Maximum Resident Size: 0 KB
Page faults with physical i/o: 352
./proxy: line 3: 21501 已放弃                  /usr/sbin/squid -f /etc/squid/squ
id.conf
用法:/etc/init.d/vsftpd {start|stop|restart|condrestart|status}

**************************************************
但我想这不一定是其中某个软件的问题,可能是系统的问题,因为当我手动逐句
运行的时候都能够正常运行

论坛徽章:
0
4 [报告]
发表于 2005-06-12 13:41 |只看该作者

新装redhat9.0系统为何不能执行shell脚本?

你确定么?
No such file or directorytion file: /etc/squid/squid.conf

你是怎么执行这个脚本的?是这么执行的么:

  1. ./proxy
复制代码

你的脚本里除了这些命令,你有没有写别的东西?你是用同一个用户么?

论坛徽章:
0
5 [报告]
发表于 2005-06-12 14:14 |只看该作者

新装redhat9.0系统为何不能执行shell脚本?

#!/bin/sh

论坛徽章:
0
6 [报告]
发表于 2005-06-12 15:58 |只看该作者

新装redhat9.0系统为何不能执行shell脚本?

增加#! /bin/sh
后,程序运行正常。非常感谢

不知能否解释一下#! /bin/sh这句话的含义?

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
7 [报告]
发表于 2005-06-12 17:11 |只看该作者

新装redhat9.0系统为何不能执行shell脚本?

原帖由 "crfzpf" 发表:
增加#! /bin/sh
后,程序运行正常。非常感谢

不知能否解释一下#! /bin/sh这句话的含义?

unix/linux世界里所有的脚本语言,都是用#!开头
意思是告诉内核用哪种shell解释该脚本!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP