管道输出到一个shell脚本|亚马逊 Linux

Posted

技术标签:

【中文标题】管道输出到一个shell脚本|亚马逊 Linux【英文标题】:piping the output into a shell script | Amazon Linux 【发布时间】:2016-01-17 23:48:40 【问题描述】:

我有一个案例,我需要在操作系统 Amazon Linux 中使用命令启动一个 shell 脚本。 以下是我通过的命令

[premkumar@rails-app-5 ~]$ sudo rds-watch-db-logfile fdstaging --log-file-name slowquery/mysql-slowquery.log | ./watch.sh

以下是回复..

-bash: ./watch.sh: Permission denied

Watch.sh

#! /bin/bash
URL="https://collectors.sumologic.com/receiver/v1/http/<unique URL string>"
while read data;
do
        curl --data "$data" $URL
done

--结束

参考链接是https://www.sumologic.com/2014/07/28/pushing-aws-rds-logs-to-sumo-logic/

谁能帮帮我?我需要使用命令运行这个 shell 脚本。请帮忙。

【问题讨论】:

【参考方案1】:

您可能没有在脚本上设置可执行位。请尝试chmod a+x watch.sh,然后重试。

【讨论】:

或者只做sh ./watch.sh。无需修改权限。

以上是关于管道输出到一个shell脚本|亚马逊 Linux的主要内容,如果未能解决你的问题,请参考以下文章