linux - PPSS 外壳脚本

标签 linux macos parallel-processing sox

我制作了一个简单的 shell 脚本来使用 SoX 处理 mp3 文件。

for f in ./*.mp3; do sox "$f" "${f%%.mp3}S.mp3" silence 1 0.02 1% -1 0.02 1%; done

语法应该是这样的:

sox in.wav out.wav silence 1 0.1 1% -1 0.1 1%

它将消除文件夹中文件的静音,并创建一个末尾带有“X”的新文件(以区别于原始文件)。我将脚本保存在我的/bin 文件夹中,它工作正常。

但是,现在我想将它与 PPSS 一起使用,以便并行运行 8 个实例。我似乎无法让它工作,但在日志文件中,我不断收到的错误是日志中的这个错误:

/usr/local/bin/ppss:第 2283 行:soxy.sh/Users/marw/Downloads/testfolder//ppss_dir/job_log/_Users_marw_Downloads_testfolder__10_audio_mp3:没有那个文件或目录

状态:失败 总处理时间(hh:mm:ss):00:00:01

PPSS 语法应该是这样的:

|P|P|S|S| Distributed Parallel Processing Shell Script 2.97

usage: /usr/local/bin/ppss [[ -d <sourcedir> | -f <sourcefile> ]]  [[ -c '<command> "$ITEM"' ]] 
                 [[ -C <configfile> ]] [[ -j ]] [[ -l <logfile> ]] [[ -p <# jobs> ]] 
                 [[ -q ]] [[ -D <delay> ]] [[ -h ]] [[ --help ]] [[ -r ]] [[ --daemon ]] 

Examples:
                 /usr/local/bin/ppss -d /dir/with/some/files -c 'gzip '
                 /usr/local/bin/ppss -d /dir/with/some/files -c 'cp "$ITEM" /tmp' -p 2
                 /usr/local/bin/ppss -f <file> -c 'wget -q -P /destination/directory "$ITEM"' -p 10

我是 shell 脚本的新手,如果这是一个愚蠢的问题,请原谅我。我的操作系统是 MacOS 10.11.5。

这就是我正在尝试使用 PPSS:

ppss -d /Users/marw/Downloads/testfolder -c 'soxy.sh'

也许我必须以不同的方式编写我的原始脚本?不过,它在没有 PPSS 的情况下也能正常工作。

编辑:

我在这里得到了一个调试日志:http://pastebin.com/wak47rf8

最佳答案

-c 参数末尾必须有一个尾随空格。这有效:

ppss -d /Users/marw/Downloads/testfolder -c 'soxy.sh '

虽然这不起作用:

ppss -d /Users/marw/Downloads/testfolder -c 'soxy.sh'

我从 Github 上的 PPSS wiki 得到这个:

The -c option specifies the command that will be executed by PPSS in parallel for each file within the directory specified by -d. In this example the command has a trailing space, which is necessary since the command will expand to 'gzip example.tar' when executed. If the space is omitted, an error will occur.

关于linux - PPSS 外壳脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38442590/

相关文章:

C 代码在 Windows 中崩溃,但在 Linux 中不会

python - 为什么 P4Python 无法识别 P4CONFIG 设置?

ruby - 带有 TK 安装的 RVM Ruby (OSX)

xcode - 如何在没有 XCode 的情况下构建沙盒应用程序?

linux - spawn_id : spawn id exp6 not open

linux - 网络中已映射 300 台计算机后 Samba 共享重定向

python - ca 证书 Mac OS X

bash - Matlab 和 gnu 并行

multithreading - F# 并行设计模式

parallel-processing - 多进程模块加载