Solved

Auto start a server application

Posted on 2007-11-27
7
234 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
  • 3
  • 3
7 Comments
 
LVL 43

Accepted Solution

by:
ravenpl earned 500 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
Utilizing an array to gracefully append to a list of EmailAddresses
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

759 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

20 Experts available now in Live!

Get 1:1 Help Now