这是我尝试运行多个exec命令,但我收到的是电子邮件的输出,但不是短信的输出。有没有办法运行这两个exec命令?
description "starts a kafka consumer for email and sms "
respawn
start on runlevel [2345]
stop on runlevel [!2345]
env FOUNDATION_HOME=/opt/home/configs
env VIRTUAL_ENV=/opt/home/virtualenvs/analytics
# run as non privileged user
setuid xxx
setgid xxx
console log
chdir /opt/xxx
exec stdbuf -oL /opt/xxx/virtualenvs/analytics/bin/python -m yukon.pipelinerunnerexternal /opt/xxx/configs/datastream.pheme_sms > /tmp/sms.out 2>&1
exec stdbuf -oL /opt/xxx/virtualenvs/analytics/bin/python -m yukon.pipelinerunnerexternal /opt/xxx/configs/datastream.pheme_email > /tmp/email.out 2>&1
post-start script
PID=`status kafka_upstart | egrep -oi '([0-9]+)$' | head -n1`
echo $PID > /var/tmp/kafka_upstart.pid
end script
post-stop script
rm -f /var/tmp/kafka_upstart.pid
end script
答案 0 :(得分:0)
您可以尝试将它们与&&
联系起来(假设它们没有无限期阻止):
exec stdbuf -oL /opt/xxx/virtualenvs/analytics/bin/python -m yukon.pipelinerunnerexternal /opt/xxx/configs/datastream.pheme_sms > /tmp/sms.out 2>&1 && stdbuf -oL /opt/xxx/virtualenvs/analytics/bin/python -m yukon.pipelinerunnerexternal /opt/xxx/configs/datastream.pheme_email > /tmp/email.out 2>&1
或者将命令放在单独的脚本kafkalaunch.sh
中,然后运行脚本:
exec kafkalaunch.sh
在我看来哪个更优雅。