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
Solved

Auto start a server application

Posted on 2007-11-27
7
237 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
modify powershell script to not inherit ntfs permission from parent 11 78
Best way to split and output to csv in bash 2 67
linux pull logs and export FTP 4 78
bash file 10 49
The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
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…
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…

856 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