Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7431177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:15:16+00:00 2026-05-29T09:15:16+00:00

This sounds like a noob question for me but I need to ask it.

  • 0

This sounds like a noob question for me but I need to ask it.

So I coded a small file server application, which listens to port 21 through sockets. It receives byte arrays, and then write files (usually jpg files), works great on IDE.

I want to put it live, running permanently in the server so remote applications can send the byte arrays to the port 21 on which my server app is listening.

The physical server OS is CentOS 6, but I can set Ubuntu and many redhat flavors of Linux (you know cloud servers).

So, how can I code a daemon (maybe a shell script) to keep this java class as a service?
say I can write:

service jMyFileApp {start|stop|restart|status}

I tried googling it but, I’m kind of lost… I don’t know how to ask it to Google

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:15:17+00:00Added an answer on May 29, 2026 at 9:15 am

    Here’s the service script I use to start and stop Tomcat (which is basically equivalent to what you are trying to do):

    #! /bin/sh
    case "$1" in
    start)   /usr/local/jakarta/tomcat/bin/startup.sh ;;    
    stop)    /usr/local/jakarta/tomcat/bin/shutdown.sh ;;
    restart) /bin/sh $0 stop
    /bin/sh $0 start ;;
    *)   echo "Usage: $0 {start|stop}"
    exit 1 ;;
    esac
    

    That is under /etc/init.d/tomcat. So basically there are shell scripts that understand how to start and stop Tomcat, and the service script just delegates to those.

    In your case, just provide some simple shell scripts that can start/stop your custom server (that will likely be the most challenging part), and then invoke them from the service script (i.e. vi /etc/init.d/jMyFileApp, copy/paste the Tomcat script above, edit the paths as appropriate to point at your custom startup scripts, and then chmod a+rx /etc/init.d/jMyFileApp).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this sounds like a really stupid question, but I need to make
This sounds like a stupid question but, after uploading a file the file isnt
I know this sounds like an odd question, but I need to keep a
This sounds like a trivia question but I really need to know. If you
This sounds like a look-up-in-the-manual question to me, but I can't find it. Suppose
This sounds like a really simple question, but I am new to PHP. If
I know this sounds like a really obvious question, but it's proving harder to
I'm sure this sounds like a n00b question, but how do I add sub
Sounds like a weird question, but say I have something like this: $.post( /myajax.php,
This sounds like a simple enough question, but can't find the answer for the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.