Automatic restart Tomcat on Windows script via TaskScheduler daily - A command line to add / remove new Windows "Cron" like job



Similar documents
Backing Up TestTrack Native Project Databases

DS License Server V6R2013x

Using the IPMI interface

CrontabFile Converter

Apache Tomcat ISAPI Redirector and Canto Cumulus WPP

DS License Server. Installation and Configuration Guide. 3DEXPERIENCE R2014x

Introduction. This white paper provides technical information on how to approach these steps with Symantec Antivirus Corporate edition.

How do I install Active Directory on my Windows Server 2003 server?

Demonstration of Windows XP Privilege Escalation Exploit

Oracle Exam 1z0-102 Oracle Weblogic Server 11g: System Administration I Version: 9.0 [ Total Questions: 111 ]

1 How to install CQ5 with an Application Server

Extending Remote Desktop for Large Installations. Distributed Package Installs

Notepad++ The COMPSCI 101 Text Editor for Windows. What is a text editor? Install Python 3

D-Link DAP-1360 Repeater Mode Configuration

XCloner Official User Manual

Application Note - JDSU PathTrak Video Monitoring System Data Backup and Restore Process

Infor Warehouse Mobility for Infor ERP LN Installation Guide

More about Continuous Integration:

How to. Install Active Directory. Server 2003

SIMIAN systems. Setting up a Sitellite development environment on Windows. Sitellite Content Management System

Publish Acrolinx Terminology Changes via RSS

IBM Tivoli Network Manager IP Edition V3.8

Installing BIRT Analytics 4.4

MobaXTerm: A good gnome-terminal like tabbed SSH client for Windows / Windows Putty Tabs Alternative

Scheduling in SAS 9.3

TCH Forecaster Installation Instructions

Working With Your FTP Site

StreamServe Persuasion SP5 Control Center

Installing and Using the Zimbra Reporting Tool

Running 4D Server as a Service on Windows

Tutorial: Packaging your server build

SAMBA VI: As a Domain Controller

OroTimesheet 7 Installation Guide

IceWarp to IceWarp Server Migration

McAfee Network Threat Response (NTR) 4.0

While You Were Sleeping - Scheduling SAS Jobs to Run Automatically Faron Kincheloe, Baylor University, Waco, TX

Introduction Deploying Deep Freeze Enterprise with BigFix

BMC Remedy Integration Guide

Configure Single Sign on Between Domino and WPS

dotdefender v5.12 for Apache Installation Guide Applicure Web Application Firewall Applicure Technologies Ltd. 1 of 11 support@applicure.

DS License Server. Installation and Configuration Guide. 3DEXPERIENCE R2016x

Web Parser for Hyper-V Bandwidth Meter

Use Enterprise SSO as the Credential Server for Protected Sites

HRC Advanced Citrix Troubleshooting Guide. Remove all Citrix Instances from the Registry

NetIQ Access Manager 3.2 integration

Printer Connection Manager

Installing Microsoft Exchange Integration for LifeSize Control

Top 10 Tricks and Tools of an Oracle EPM Administrator Effective EPM Administration

ILTA HAND 6B. Upgrading and Deploying. Windows Server In the Legal Environment

This appendix describes the following procedures: Cisco ANA Registry Backup and Restore Oracle Database Backup and Restore

How To Sync Quickbooks With Qvinci.Com On A Pc Or Macbook Or Mac Book (For A Webbook) With A Flashbook (For An Ubuntu Account) With An Ipo (For Macbook) On A Mac

Control-M for Hadoop. Technical Bulletin.

JAMF Software Server Installation Guide for Linux. Version 8.6

Scheduling in SAS 9.4 Second Edition

A SHORT INTRODUCTION TO DUPLICITY WITH CLOUD OBJECT STORAGE. Version

Knoa MicroStrategy Web Configuration Table of contents

Getting Started Guide

GETTING STARTED WITH FLEXI-CLOUD

Shakambaree Technologies Pvt. Ltd.

Linux Crontab: 15 Awesome Cron Job Examples

Report and Dashboard Template User Guide

Introduction. Installation of SE S AM E BARCODE virtual machine distribution. (Windows / Mac / Linux)

Setting up FileMaker 10 Server

Oracle EXAM - 1Z Oracle Weblogic Server 11g: System Administration I. Buy Full Product.

Plesk 11 Manual. Fasthosts Customer Support

URGENT: For all merchants using ICVERIFY over Datawire

1. If there is a temporary SSL certificate in your /ServerRoot/ssl/certs/ directory, move or delete it. 2. Run the following command:

Handle Tool. User Manual

Red Hat Linux 7.2 Installation Guide

Upgrading Your Web Server from ClientBase Browser Version 2.0 or Above to Version 2.1.1

MapGuide Open Source Repository Management Back up, restore, and recover your resource repository.

Wakanda Studio Features

McAfee epolicy Orchestrator Software

How to Install SMTPSwith Mailer on Centos Server/VPS

TIBCO Spotfire Statistics Services Installation and Administration Guide

Cannot connect to Microsoft SQL Server on network

Rev 7 06-OCT Site Manager Installation Guide

Published. Technical Bulletin: Use and Configuration of Quanterix Database Backup Scripts 1. PURPOSE 2. REFERENCES 3.

Module Customer Ratings and Reviews Pro + Google Rich Snippets Module

DiskPulse DISK CHANGE MONITOR

About This Document 3. About the Migration Process 4. Requirements and Prerequisites 5. Requirements... 5 Prerequisites... 5

INSTALLATION GUIDE VERSION

JAMF Software Server Installation Guide for Windows. Version 8.6

How To Enable A Websphere To Communicate With Ssl On An Ipad From Aaya One X Portal On A Pc Or Macbook Or Ipad (For Acedo) On A Network With A Password Protected (

This presentation will discuss how to troubleshoot different types of project creation issues with Information Server DataStage version 8.

Installation Guide. MashZone. Version 9.6

User Permissions Published on Panopto Support (

By default, STRM provides an untrusted SSL certificate. You can replace the untrusted SSL certificate with a self-signed or trusted certificate.

How to - Install EventTracker and Change Audit Agent

Microsoft Corporation. Project Server 2010 Installation Guide

2 Downloading Access Manager 3.1 SP4 IR1

RTI Quick Start Guide for JBoss Operations Network Users

Task Scheduler. Morgan N. Sandquist Developer: Gary Meyer Reviewer: Lauri Watts

Microsoft s SBS 2003 Best Practice Guide

TIBCO Spotfire Statistics Services Installation and Administration

Fuse ESB Enterprise Installation Guide

CYAN SECURE WEB APPLIANCE. User interface manual

Transcription:

Automatic restart Tomcat on Windows script via TaskScheduler daily - A command line to add / remove new Windows "Cron" like job Author : admin I'm responsbile for a project environment made up of 3 components which is occasionally dying. Here is a short raw overview of environment Apache Reverse Proxy (entry door to app server) Tomcat Server with an Application enabling web access A Java Standalone application using SQLite database The Tomcat and Java Standalone application is running on top of Windows 2008 RC2 Standard, the overall environment is becoming inacessible periodically and in order to solve that the customer decided to implement a daily Windows server reboot in my opinion this is very bad approach as it is much better to just set an auto reboot of each of components using few tiny batch scripts and Windows Taskmgr, however as the customer is king and decided to implement the reboot its their own thing. However even fter the daily server reboot was set once a week or so the application was becoming inaccessible and a Tomcat server restart was necessery as a fix. Finally as a work-around to the issue, I've proposed the logical thing to automatically restart Tomcat once a day early in morning, here is how Tomcat auto Restart was implemented on the Win server: 1. Check out the name of running Tomcat service First thing is to use the sc command to find out the Tomcat application name: 1 / 10

C:UsersGeorgi>sc query state= all findstr "Tomcat" SERVICE_NAME: Tomcat7_r2c DISPLAY_NAME: Apache Tomcat Tomcat7_r2c C:UsersGeorgi> 2. Create bat script to stop and start Tomcat service Press keyboard Win-button + R, start notepad type inside: @echo off sc stop Tomcat7_r2c && sc start Tomcat7_r2c ( 2 / 10

Don't be confused from screenshot that I have Tomcat7_MyApp instead of Tomcat7_r2c, but I made screenshot in hurry for another app. Save the file, somewhere (preferrably) in application folder/bin/ it is best to save it once with bat extension MyApp-Tomcat_Restart.bat and once as MyApp-Tomcat_Restart.xml (XML format file is later needed for import to Task Scheduler which understands.xmls). The.bat file is good to have because it is useful to somtimes restart Tomcat manually by running it (in case of some sudden Tomcat Appserver occurs even though the auto-restart script). 3. Create new Task using command line (cmd.exe) Task can be created also from command line using following syntax: 3 / 10

schtasks /Create [/S [/U [/P [ ]]]] /XML /TN Simple way to create a new Windows task is shown in below command, it will set my Tomcat Restart script to run everyday in 05:00 early morning when no employees are using the system: schtasks /Create /SC DAILY /TN "My Task" /TR "C:UsersGeorgiDesktopmyApp- Tomcat_Restart.bat" /ST 05:00 SUCCESS: The scheduled task "Tomcat Restart Task" has successfully been created. 4 / 10

4. Create / Import new Windows "Cron" job Alternative way is to use Task Scheduler GUI frontend and create new (Basic Task) or import just created script To run Windows Task Scheduler from comamnd line : Taskschd.msc 5 / 10

To import already existing.xml formatted file for Task scheduler, right click on the Task Scheduler (Local) and select Import task 6 / 10

Import the myapp-tomcat_restart.xml previously created file Adjust settings to suit your needs, but what change atleast: the path to the myapp-tomcat_restart.bat file in Actions tab the Local User account with which script will be running (administrator) in General tab 7 / 10

After making all changes you will be prompted for server Administrator account password 5. check existing Win Cron job from command line To see the configured (Scheduled Tasks) in command line mode with a command: Schtasks.exe 8 / 10

The command is Windows equivalent to UNIX / Linux's crontab, e.g.: crontab -u root -l 6. Delete existing Windows Task Job from Command line If you happen to need to delete just created task or any other task from command line (Assuming that you 9 / 10

Powered by TCPDF (www.tcpdf.org) know the previously created task name), use cmd: Walking in Light with Christ - Faith, Computing, Diary C:>schtasks /Delete /TN "Tomcat Restart Task" WARNING: Are you sure you want to remove the task "Tomcat Restart Task" (Y/N)? y SUCCESS: The scheduled task "Tomcat Restart Task" was successfully deleted. Task completed, Tomcat will auto-restart on Windows host at your scheduled time. Feedback is mostly welcome :) Enjoy 10 / 10