• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1117
  • Last Modified:

run java app as init.d service

I have a java app that I can startup using a shell script. Where in /etc/init.d do I put a file to run this shell script?

And then, once I put it there, how do I tell it to start without having to reboot the server? I can't just run the script because then it'd quit as soon as I logged out.
0
HappyEngineer
Asked:
HappyEngineer
1 Solution
 
wesly_chenCommented:
> I have a java app that I can startup using a shell script.
Which Linux do you have?
Say you run the java app in shell like:
java app.java &   (& means run in background, so it won't quit when you logout)

Add
java app.java &
into

/etc/rc.d/rc.local     for (Fedora/RedHat)
/etc/rc.d/boot.local  (SuSE)
/etc/init.d/local  (Debian) (If not there, create one with first line "#!/bin/sh" )

Regards,

Wesly
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Tackle projects and never again get stuck behind a technical roadblock.
Join Now