mercredi 4 mars 2015

Log File not Creating after tomcat restart

I have an ec2 instance from which i am remotely logging in to a remote EC2 server (as ec2-user) on which my application is hosted in its tomcat server. The tomcat server generates a log file for this particular application.


If i delete the log file (test_app.log) and restart the server manually using startup.sh command a new log file with same name gets created but when i try to do this by remote login it is not working. The tomcat server is restarting (i have verified it on my browser) but the log file do not get genrated. As i want a separate log for all my application runs , i am first stopping the tomcat by killing it, then i move the test_app.log to other name with time stamp, and then restart the server. when i use automated script to ssh for the first time everything happens as planned above but from the next iteration nothing happens.Even after using touch no new file gets created.


Please note if i do entire process manually ,all the commands run properly and everything works fine.



ssh -i $Public_Key_Loc -tt $Remote_user@$PrivateIpSPL <<-ENDSSH
sudo su - spluser
kill -9 $(ps -elf | grep tomcat|cut -d ' ' -f6 | head -n 1)
mv /opt/tomcat/current/logs/spl/spl-test-tool/test_app.log /opt/tomcat/current/logs/spl/spl-test-tool/$(date "+%Y.%m.%d-%H.%M.%S").test_app.log
touch test_app.log
chown spluser:splgrp test_app.log
chmod 644 test_app.log
/opt/tomcat/current/bin/startup.sh
exit
exit
ENDSSH




Aucun commentaire:

Enregistrer un commentaire