I am executing a daily script in ubuntu server via Cron which runs a java file. I want to it to be included in if/else block such that if the java file is executed successfully its should send an echo message "successfull" and if it fails it should send an echo message "failed".
Here are the existing lines for the script updateGroupScores.sh
java -classpath "/home/ubuntu/live/build/WEB-INF/lib/*:/var/lib/tomcat7/lib/*:/home/ubuntu/live/build/WEB-INF/classes/" com.generalsentiment.update.UpdateGroupScores > /var/gs/livecron/crongroupsentimentscores.log
i want to modify them something like -
if (java file runs successfull)
then
echo "cron job successfull"
else
then
echo "cron job failed"
-- Thanks