Solved

Create Init startup script in Linux

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

In this article we have discussed the manual scenarios to recover data from Windows 10 through some backup and recovery tools which are offered by it.
Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
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.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

717 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