Solved

Create Init startup script in Linux

Posted on 2014-12-07
1
336 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The purpose of this article is to demonstrate how we can use conditional statements using Python.
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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

12 Experts available now in Live!

Get 1:1 Help Now