Suggestion?: run sc...
 
Notifications
Clear all

10/18/2023 Map Stopped Working?
Visit this post for the fix

Suggestion?: run scripts through screen

2 Posts
2 Users
0 Reactions
1,035 Views
(@zeroengineland)
Trusted Member
Joined: 4 years ago
Posts: 52
Topic starter  

As I've been troubleshooting some stuff with LiveSectional, I've been using screen quite a lot.  The debug log is pretty good, but there are a few things that are only seen when you have access to a shell.  I found a syntax problem with the debug log by running something from the command line where I saw the stack trace.

There are a few things that are only displayed on the console.  By running a command with screen, it prints its console messages to a virtual screen, and when a program dies I can access the virtual console and see what its last error message was.  metar-v4 prints its cycle number to stdout, so you only see it when you run the program from shell or by attaching a monitor.

So, rather than call programs directly, I'd do the equivalent of this:

pi@LiveSectionalV4:/NeoSectional $ screen -dmS metar

pi@LiveSectionalV4:/NeoSectional $ screen -S metar -X stuff "sudo python3 metar-v4.py

"

In the first command, "metar" is just a name for the screen session.  In the second command, "stuff" is used to send the command to the running screen session, and you need the line break before the second quote to push the return key and start running the script.

then I can use screen -r metar and see stdout from the metar-v4 program, including the stack trace if it crashes, or the cycle number printed out by metar-v4 to stdout.


   
Quote
Mark Harris
(@markyharris)
Member Admin Registered
Joined: 5 years ago
Posts: 559
 

Sound interesting. I've not played with Screen. I'll have to read up on it. Thanks for the info. - Mark


   
ReplyQuote
Share: