Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Auto start a server application

Posted on 2007-11-27
7
Medium Priority
?
242 Views
Last Modified: 2008-02-01
Dear experts,
I have an a server that need to start on system start

This is what I'm currently doing to start the server

connect to server (Fedora) through SSH
root # cd <server1 path>/bin
root # screen
root # su user1
user1 # python server.py -p 8765 .....
ctrl+A ctrl+D                          // to detached the screen
root@<server1 path>/bin#

you can ask for further details

please advice me on starting the server automatically

Thank you
0
Comment
Question by:Sinoj Sebastian
[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
  • 3
  • 3
7 Comments
 
LVL 43

Accepted Solution

by:
ravenpl earned 2000 total points
ID: 20357212
put Your commands into /etc/rc.d/rc.local script (is started with system startup)

su - user1 -c "screen -dm python -p 8765 ..."
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20357294
Hi,

You may add a startup script under /etc/rc3.d

The script name should look like SnnName

e.g. S99startmyserver

the script should be executable

chmod +x /etc/rc3.d/S99startmyserver

The script should all necessary setting of env variables and full path names to commands and files

0
 
LVL 12

Author Comment

by:Sinoj Sebastian
ID: 20357373
hello ravenpl,
I tried this

root@<server path>/bin # su - user1 -c "screen -dm python tinyerp-server.py "

now "screen -r" return "There is no screen to be resumed." What I am doing wrong?

please help. I am a newbie on this topic.
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 43

Expert Comment

by:ravenpl
ID: 20357516
tinyerp-server.py should not go backgroud. Does it? If it goes, then You don't need the screen to control it?
Or maybe try full paths like
/usr/bin/python /path/to/tinyerp-server.py
0
 
LVL 12

Author Comment

by:Sinoj Sebastian
ID: 20357612
I need to start more than one server. I need to use "screen -r". And I cannot start server like /path/to/tinyerp-server.py as it cause some problem with application root reference. Can you help me with this.
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 20357750
Why those servers have to be run from within screen?
Screen is needed if the server will not detach from controlling terminal.

another option is to use nohup(man nohup)

> I need to start more than one server.
Run more screens.

> And I cannot start server like /path/to/tinyerp-server.py
make sure CWD is /path/to/
0
 
LVL 12

Author Comment

by:Sinoj Sebastian
ID: 20358193
hi ravenpl,
  Thank you very much

:)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

636 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