starting script in screen starting script in screen shell shell

starting script in screen


You can use:

screen -dm bash -c 'python your_script.py'

If you need several commands, use ;:

screen -dm bash -c 'source ~/.bash_profile; python your_script.py'

Documentation:

https://www.gnu.org/software/screen/manual/screen.html:

-d -m: Start screen in detached mode. This creates a new session but doesn't attach to it. This is useful for system startup scripts.

http://linux.about.com/library/cmd/blcmdl1_sh.htm :

-c string: If the -c option is present, then commands are read from string. If there are arguments after the string, they are assigned to the positional parameters, starting with $0.