show output of python file on console

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite
1












in console I run pgrep python | xargs ps and it shows me 2 python scripts running on background.
But how can I show output of each script on console?



P.S. I just want to see last printed outputs from scripts to know if scripts are running fine or printed some exceptions or my messages.



Additional subquetion - What in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?







share|improve this question


















  • 1




    Where is the output going now?
    – PiedPiper
    Dec 7 '17 at 14:16










  • now it is standard console, I mean when I run the script from command line, it shows me output. But when I log off from ssh and then log in again (script is running from previous), then I dont see output anymore for that script.
    – peter
    Dec 7 '17 at 14:33











  • How do you run the scripts?
    – 123
    Dec 7 '17 at 15:02










  • An answer is "use screen" but I'm sure there's a duplicate out there with some proper instructions. Related - unix.stackexchange.com/questions/22781/…
    – roaima
    Dec 7 '17 at 16:26











  • And what in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?
    – peter
    Dec 8 '17 at 8:35














up vote
1
down vote

favorite
1












in console I run pgrep python | xargs ps and it shows me 2 python scripts running on background.
But how can I show output of each script on console?



P.S. I just want to see last printed outputs from scripts to know if scripts are running fine or printed some exceptions or my messages.



Additional subquetion - What in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?







share|improve this question


















  • 1




    Where is the output going now?
    – PiedPiper
    Dec 7 '17 at 14:16










  • now it is standard console, I mean when I run the script from command line, it shows me output. But when I log off from ssh and then log in again (script is running from previous), then I dont see output anymore for that script.
    – peter
    Dec 7 '17 at 14:33











  • How do you run the scripts?
    – 123
    Dec 7 '17 at 15:02










  • An answer is "use screen" but I'm sure there's a duplicate out there with some proper instructions. Related - unix.stackexchange.com/questions/22781/…
    – roaima
    Dec 7 '17 at 16:26











  • And what in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?
    – peter
    Dec 8 '17 at 8:35












up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





in console I run pgrep python | xargs ps and it shows me 2 python scripts running on background.
But how can I show output of each script on console?



P.S. I just want to see last printed outputs from scripts to know if scripts are running fine or printed some exceptions or my messages.



Additional subquetion - What in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?







share|improve this question














in console I run pgrep python | xargs ps and it shows me 2 python scripts running on background.
But how can I show output of each script on console?



P.S. I just want to see last printed outputs from scripts to know if scripts are running fine or printed some exceptions or my messages.



Additional subquetion - What in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?









share|improve this question













share|improve this question




share|improve this question








edited Dec 8 '17 at 8:35

























asked Dec 7 '17 at 14:03









peter

2151413




2151413







  • 1




    Where is the output going now?
    – PiedPiper
    Dec 7 '17 at 14:16










  • now it is standard console, I mean when I run the script from command line, it shows me output. But when I log off from ssh and then log in again (script is running from previous), then I dont see output anymore for that script.
    – peter
    Dec 7 '17 at 14:33











  • How do you run the scripts?
    – 123
    Dec 7 '17 at 15:02










  • An answer is "use screen" but I'm sure there's a duplicate out there with some proper instructions. Related - unix.stackexchange.com/questions/22781/…
    – roaima
    Dec 7 '17 at 16:26











  • And what in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?
    – peter
    Dec 8 '17 at 8:35












  • 1




    Where is the output going now?
    – PiedPiper
    Dec 7 '17 at 14:16










  • now it is standard console, I mean when I run the script from command line, it shows me output. But when I log off from ssh and then log in again (script is running from previous), then I dont see output anymore for that script.
    – peter
    Dec 7 '17 at 14:33











  • How do you run the scripts?
    – 123
    Dec 7 '17 at 15:02










  • An answer is "use screen" but I'm sure there's a duplicate out there with some proper instructions. Related - unix.stackexchange.com/questions/22781/…
    – roaima
    Dec 7 '17 at 16:26











  • And what in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?
    – peter
    Dec 8 '17 at 8:35







1




1




Where is the output going now?
– PiedPiper
Dec 7 '17 at 14:16




Where is the output going now?
– PiedPiper
Dec 7 '17 at 14:16












now it is standard console, I mean when I run the script from command line, it shows me output. But when I log off from ssh and then log in again (script is running from previous), then I dont see output anymore for that script.
– peter
Dec 7 '17 at 14:33





now it is standard console, I mean when I run the script from command line, it shows me output. But when I log off from ssh and then log in again (script is running from previous), then I dont see output anymore for that script.
– peter
Dec 7 '17 at 14:33













How do you run the scripts?
– 123
Dec 7 '17 at 15:02




How do you run the scripts?
– 123
Dec 7 '17 at 15:02












An answer is "use screen" but I'm sure there's a duplicate out there with some proper instructions. Related - unix.stackexchange.com/questions/22781/…
– roaima
Dec 7 '17 at 16:26





An answer is "use screen" but I'm sure there's a duplicate out there with some proper instructions. Related - unix.stackexchange.com/questions/22781/…
– roaima
Dec 7 '17 at 16:26













And what in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?
– peter
Dec 8 '17 at 8:35




And what in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?
– peter
Dec 8 '17 at 8:35










1 Answer
1






active

oldest

votes

















up vote
6
down vote













The easiest way is to use screen or tmux. Both allow you to disconnect from a running session while maintaining the terminals your scripts are using for output. To use either, simply type tmux (or screen) when you connect with ssh (you might have to install tmux first but most distributions have these tools available in default repositories) and then run your script as usual. If you disconnect, run tmux attach again after reconnecting with ssh to restore your previous session.






share|improve this answer




















  • I didn't know this. Thanks looks nice. But what in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?
    – peter
    Dec 7 '17 at 17:07










  • If scripts are executed outside of interactive sessions (rc.local, cron, running as a daemon, etc.) you should redirect their output to a file or implement proper logging.
    – Denis
    Dec 8 '17 at 11:18










  • oh great, thanks for hints
    – peter
    Dec 8 '17 at 13:25










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409483%2fshow-output-of-python-file-on-console%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
6
down vote













The easiest way is to use screen or tmux. Both allow you to disconnect from a running session while maintaining the terminals your scripts are using for output. To use either, simply type tmux (or screen) when you connect with ssh (you might have to install tmux first but most distributions have these tools available in default repositories) and then run your script as usual. If you disconnect, run tmux attach again after reconnecting with ssh to restore your previous session.






share|improve this answer




















  • I didn't know this. Thanks looks nice. But what in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?
    – peter
    Dec 7 '17 at 17:07










  • If scripts are executed outside of interactive sessions (rc.local, cron, running as a daemon, etc.) you should redirect their output to a file or implement proper logging.
    – Denis
    Dec 8 '17 at 11:18










  • oh great, thanks for hints
    – peter
    Dec 8 '17 at 13:25














up vote
6
down vote













The easiest way is to use screen or tmux. Both allow you to disconnect from a running session while maintaining the terminals your scripts are using for output. To use either, simply type tmux (or screen) when you connect with ssh (you might have to install tmux first but most distributions have these tools available in default repositories) and then run your script as usual. If you disconnect, run tmux attach again after reconnecting with ssh to restore your previous session.






share|improve this answer




















  • I didn't know this. Thanks looks nice. But what in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?
    – peter
    Dec 7 '17 at 17:07










  • If scripts are executed outside of interactive sessions (rc.local, cron, running as a daemon, etc.) you should redirect their output to a file or implement proper logging.
    – Denis
    Dec 8 '17 at 11:18










  • oh great, thanks for hints
    – peter
    Dec 8 '17 at 13:25












up vote
6
down vote










up vote
6
down vote









The easiest way is to use screen or tmux. Both allow you to disconnect from a running session while maintaining the terminals your scripts are using for output. To use either, simply type tmux (or screen) when you connect with ssh (you might have to install tmux first but most distributions have these tools available in default repositories) and then run your script as usual. If you disconnect, run tmux attach again after reconnecting with ssh to restore your previous session.






share|improve this answer












The easiest way is to use screen or tmux. Both allow you to disconnect from a running session while maintaining the terminals your scripts are using for output. To use either, simply type tmux (or screen) when you connect with ssh (you might have to install tmux first but most distributions have these tools available in default repositories) and then run your script as usual. If you disconnect, run tmux attach again after reconnecting with ssh to restore your previous session.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 7 '17 at 15:04









Denis

1611




1611











  • I didn't know this. Thanks looks nice. But what in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?
    – peter
    Dec 7 '17 at 17:07










  • If scripts are executed outside of interactive sessions (rc.local, cron, running as a daemon, etc.) you should redirect their output to a file or implement proper logging.
    – Denis
    Dec 8 '17 at 11:18










  • oh great, thanks for hints
    – peter
    Dec 8 '17 at 13:25
















  • I didn't know this. Thanks looks nice. But what in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?
    – peter
    Dec 7 '17 at 17:07










  • If scripts are executed outside of interactive sessions (rc.local, cron, running as a daemon, etc.) you should redirect their output to a file or implement proper logging.
    – Denis
    Dec 8 '17 at 11:18










  • oh great, thanks for hints
    – peter
    Dec 8 '17 at 13:25















I didn't know this. Thanks looks nice. But what in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?
– peter
Dec 7 '17 at 17:07




I didn't know this. Thanks looks nice. But what in case, when scripts are automatically executed via rc.local on boot? Is there any way how to get screen for these scripts?
– peter
Dec 7 '17 at 17:07












If scripts are executed outside of interactive sessions (rc.local, cron, running as a daemon, etc.) you should redirect their output to a file or implement proper logging.
– Denis
Dec 8 '17 at 11:18




If scripts are executed outside of interactive sessions (rc.local, cron, running as a daemon, etc.) you should redirect their output to a file or implement proper logging.
– Denis
Dec 8 '17 at 11:18












oh great, thanks for hints
– peter
Dec 8 '17 at 13:25




oh great, thanks for hints
– peter
Dec 8 '17 at 13:25

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409483%2fshow-output-of-python-file-on-console%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)