Solved

Create Init startup script in Linux

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
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.
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…
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.:

803 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