Auto start a server application

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 -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
LVL 12
Sinoj SebastianCTO & OpenERP Project managerAsked:
Who is Participating?
ravenplConnect With a Mentor Commented:
put Your commands into /etc/rc.d/rc.local script (is started with system startup)

su - user1 -c "screen -dm python -p 8765 ..."

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

Sinoj SebastianCTO & OpenERP Project managerAuthor Commented:
hello ravenpl,
I tried this

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

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.
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

ravenplCommented: 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/
Sinoj SebastianCTO & OpenERP Project managerAuthor Commented:
I need to start more than one server. I need to use "screen -r". And I cannot start server like /path/to/ as it cause some problem with application root reference. Can you help me with this.
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/
make sure CWD is /path/to/
Sinoj SebastianCTO & OpenERP Project managerAuthor Commented:
hi ravenpl,
  Thank you very much

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.