我想通过shell脚本将不同的输入参数传递给单个jar

时间:2015-07-30 19:49:20

标签: linux shell twitter cron

我通过cron工作每隔30分钟运行一个罐子:

java -cp jarname args[0]

这些参数是twitter4j.properties

我觉得我的问题不明确.. 1.我将获得一个带有n个行数的word.list文件 2.当行为400时,我正在遍历行400行,我将传递给jar文件作为args [1]并考虑在这种情况下我的args [0]是t1-properties 3.假设我的word.list包含600行,那么前400行必须执行jar,然后执行第二行200,另一个jar必须执行t2-properties 4.所以最终每400行jar必须用不同的属性文件执行

1 个答案:

答案 0 :(得分:1)

所以你想要做这样的事情吗?

#!/bin/bash

while true
do
     java -cp jarname.jar twitter4j.properties
     sleep 30m
     #somehow get update for the twitter4j.properties
done

这将在终端中无限运行,直到您按ctrl+c将上述文件另存为:myscript.sh,然后键入:chmod u+x myscript.sh,以便它有权执行并运行类型:{ {1}}

相关问题