show output of python file on console

Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
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?
linux
add a comment |Â
up vote
1
down vote
favorite
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?
linux
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 "usescreen" 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
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
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?
linux
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?
linux
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 "usescreen" 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
add a comment |Â
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 "usescreen" 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
add a comment |Â
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.
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
add a comment |Â
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.
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
add a comment |Â
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.
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
add a comment |Â
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.
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.
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
add a comment |Â
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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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