shell script to restart a tomcat server if down

0 votes
I want a shell script to run as a cron job every half hour to check if server is running or not, if not then turn it back on.
Apr 29, 2018 in DevOps & Agile by Atul
• 10,220 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Try using systemd isntead of a cron job. Create one file for the service and the one other for timer.



Description=example job

ExecStart=/bin/bash /tmp/





reload the systemd using
systemctl daemon-reload
and use the systemctl command to start and enable the
systemctl start test.timer

systemctl enable test.timer

Hope this helps

answered Apr 29, 2018 by ajs3033
• 7,080 points

Related Questions In DevOps & Agile

+1 vote
2 answers

How do I run Apache server from Docker without mapping to a location?

If you're seeing a 500 error, that's ...READ MORE

answered Oct 18, 2018 in DevOps & Agile by lina
• 8,100 points
+13 votes
2 answers
0 votes
1 answer

How to edit file after I shell to a docker container?

Since docker images are trimmed to bare minimum ...READ MORE

answered Sep 11, 2018 in DevOps & Agile by Damon Salvatore
• 5,390 points
0 votes
1 answer
0 votes
1 answer
+13 votes
2 answers
0 votes
1 answer

How to set up a VM with KVM/qemu without VitualBox using Vagrant

Start the vagrant box using: vagrant up --provider=kvm But ...READ MORE

answered Apr 11, 2018 in DevOps & Agile by ajs3033
• 7,080 points
0 votes
2 answers

Unable to use jenkins to run oracle script on remote DB

add ORACLE_HOME  in jenkins global variable. READ MORE

answered Mar 26 in DevOps & Agile by hal

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.