Solved

Fedora Linux -- how to add a user daemon (server) process

Posted on 2014-04-16
3
700 Views
Last Modified: 2014-04-30
I have a server  "binary_server.exe" that does simple math over network for demonstrating the idea of TCP sockets.  It works fine when I start it, as a regular user, like this

>binary_server.exe &

, on the command like. And I saw it running in the background  with ps -ax | grep binary*
. But the process stayed there only for a couple of hours, and then gone. Don't know who killed it. My first question is:

How can I add this executable (daemon) as a startup process? So I don't have to start it manually.

Another related questions is:  Since the server uses network port 5001 (for example), are there anything needs to be configured in the system, other than just lifting off the firewall (which I did, for this educational server)? Or do I have to start it as the root user?  And I suspect that the OS somehow kills it when it's not active for sometime.

Thanks

ZZ
0
Comment
Question by:zzhang2006
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
rfportilla earned 500 total points
ID: 40004827
No matter what, you want this to be started from another user account (not your personal user account).  You could use root, but I like to use service specific users to limit security risks.  That user should only have access to the directories and databases required to perform its function.  If this is a stand-alone server with no sensitive information then it is probably fine to use root.

Regarding creating services, I haven't done this in a while, but I found this article that looks pretty easy to follow:

http://kezhong.wordpress.com/2011/11/19/creating-my-own-systemd-service-files-on-fedora-16x86_64/

Regarding running the service on the specified port, who is running it is irrelevant.  You need to be primarily concerned with the firewall settings on the server and any additional firewalls on the network.  There probably is not any application specific firewall.  

I can't say why the service went down when you ran it as your user, but it is possible the service crashed, the session ended, or the server was restarted.  Processes don't typically stop because they are user processes.  

Hope this helps.  Good luck.
0
 
LVL 1

Author Closing Comment

by:zzhang2006
ID: 40032247
This worked, thanks.
0
 
LVL 9

Expert Comment

by:rfportilla
ID: 40033790
Your welcome.  Glad I could help.  :-)
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!

Join & Write a Comment

Suggested Solutions

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
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.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now