Skip to content

Instantly share code, notes, and snippets.

@ricdex
Created March 19, 2020 21:52
Show Gist options
  • Save ricdex/fd17cf22d44ce32fd31579afad319488 to your computer and use it in GitHub Desktop.
Save ricdex/fd17cf22d44ce32fd31579afad319488 to your computer and use it in GitHub Desktop.
Iniciar proceso de tomcat si no existe
#!/bin/sh
output=$(ps h -C java -o "%p:%a" | grep catalina | cut -d: -f1)
if [ -z $output ]; then
echo "$(date) - Process not found, need to start"
/opt/tomcat/bin/startup.sh
else
echo "$(date) - Process found, no need to start"
fi
@ricdex
Copy link
Author

ricdex commented Mar 19, 2020

crontab
*/5 * * * * /home/culqi/tomcat_autorestart.sh >> /tmp/tomcat_autorestart.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment