Solved

Auto start a server application

Posted on 2007-11-27
7
236 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

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using Grep to Find a file 8 91
Convert OverPunch 25 64
use shell script to parse json returned by a restful service 6 103
Need script to search multiple files in one drive 13 46
Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

772 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