Solved

Create Init startup script in Linux

Posted on 2014-12-07
1
359 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

A while back when OPSMGR 2012 was released we were very excited about getting it into our environment and upgrading our 2007 implementation,  we started our planning and we then proceeded with our implementation. All went as planned & our system …
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

736 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