当前位置: 技术问答>linux和unix
shell中syntax error: unexpected end of file的问题
来源: 互联网 发布时间:2015-09-08
本文导语: 下面是个很简单的shell,单步在linux下执行没有问题. cd /Application/HttpLogcenterPublish echo "----------------LogLctPressMain---------------------" date +'%Y-%m-%d %H:%M' if ps U amber -Ho cmd | grep LogLctPressMain.jar | grep -v grep > /dev/null ...
下面是个很简单的shell,单步在linux下执行没有问题.
cd /Application/HttpLogcenterPublish
echo "----------------LogLctPressMain---------------------"
date +'%Y-%m-%d %H:%M'
if ps U amber -Ho cmd | grep LogLctPressMain.jar | grep -v grep > /dev/null
then
pid1=`ps U amber -Ho pid,cmd | grep LogLctPressMain.jar | grep -v grep | head -1 |awk '{print $1}'`
echo "LogLctPressMain.jar is running! main process id = $pid1"
else
/usr/java/j2sdk1.4.2_06/bin/java -jar LogLctPressMain.jar
fi
给点建议,谢了.
cd /Application/HttpLogcenterPublish
echo "----------------LogLctPressMain---------------------"
date +'%Y-%m-%d %H:%M'
if ps U amber -Ho cmd | grep LogLctPressMain.jar | grep -v grep > /dev/null
then
pid1=`ps U amber -Ho pid,cmd | grep LogLctPressMain.jar | grep -v grep | head -1 |awk '{print $1}'`
echo "LogLctPressMain.jar is running! main process id = $pid1"
else
/usr/java/j2sdk1.4.2_06/bin/java -jar LogLctPressMain.jar
fi
给点建议,谢了.
|
Kyodai.jar放在/root/g/oth
#!/bin/sh
# runjar.sh
cd /root/g/oth
echo "----------------LogLctPressMain---------------------"
date +'%Y-%m-%d %H:%M'
if ps U amber -Ho cmd | grep LogLctPressMain.jar | grep -v grep > /dev/null
then
pid1=`ps U amber -Ho pid,cmd | grep LogLctPressMain.jar | grep -v grep | head -1 |awk '{print $1}'`
echo "LogLctPressMain.jar is running! main process id = $pid1"
else
/root/sun/j2eesdk1.4_beta2/jdk/bin/java -jar Kyodai.jar
fi
#!/bin/sh
# runjar.sh
cd /root/g/oth
echo "----------------LogLctPressMain---------------------"
date +'%Y-%m-%d %H:%M'
if ps U amber -Ho cmd | grep LogLctPressMain.jar | grep -v grep > /dev/null
then
pid1=`ps U amber -Ho pid,cmd | grep LogLctPressMain.jar | grep -v grep | head -1 |awk '{print $1}'`
echo "LogLctPressMain.jar is running! main process id = $pid1"
else
/root/sun/j2eesdk1.4_beta2/jdk/bin/java -jar Kyodai.jar
fi
|
语法错误?shell不怎么玩,不太清楚……
不过先检查你的语法有没有错误,应该是else那里有问题。
不过先检查你的语法有没有错误,应该是else那里有问题。
|
是这一句
“/usr/java/j2sdk1.4.2_06/bin/java -jar LogLctPressMain.jar”
在调用其他程序的时候出了错。
“/usr/java/j2sdk1.4.2_06/bin/java -jar LogLctPressMain.jar”
在调用其他程序的时候出了错。
|
你确定LogLctPressMain.jar是在/Application/HttpLogcenterPublish目录下,
从根目录开始.
cd /Application/HttpLogcenterPublish #可能这里
从根目录开始.
cd /Application/HttpLogcenterPublish #可能这里