Ano-Tech Computers
Enter keyword:

linux: Using screen in an init script
Problem:
What are the proper command line parameters for starting a program in a detached screen session?
 
Solution:
cd /full/path
screen -dmUS title ./program

Notice that when 'program' is terminated, the screen session will terminate as well. If you want to guarantee that the program keeps running even if it crashes, consider writing a looping wrapper such as this

#!/bin/bash
while echo; do ./program; done

and run the wrapper in your screen session.

 
Discuss this solution
Did this article solve your problem? Yes No Did not apply

We welcome anyone who is willing to contribute to this public knowledge base, contact siteadmin@atc.no if you have information you would like to share. The idea is not to replace the commercial support sites, but to publish those hard-to-find solutions you've found yourself looking for over and over again.

Show all articles