Solved

Create Init startup script in Linux

Posted on 2014-12-07
1
343 Views
Last Modified: 2014-12-14
I have a java executable (.jar) file for which i want to create a linux script for starting,restarting,checking the status and stopping it.  

Currently, the jar file is started with something like
"nohup java -jar mydaemon.jar </dev/null> log/daemonlog.log 2>&1 &".

I want to be able to start with something like
start mydaemon
stop mydaemon
status mydaemon
restart mydaemon


The daemon runs on Centos.
0
Comment
Question by:Laolu Olapegba
1 Comment
 
LVL 19

Accepted Solution

by:
NickUpson earned 500 total points
ID: 40485720
depends upon which version of centos you are using, if its 5. something then the existing scripts are in /etc/init.d

copy one and adjust the contents to include your commandline

you can then do "service mydeamon start|stop|etc"
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now