Solved

Auto start a server application

Posted on 2007-11-27
7
235 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

895 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

11 Experts available now in Live!

Get 1:1 Help Now