GNU screen utility for DBAs
An extremely useful option for those who wants to script some actions is the ability to send a command to any of your running screen sessions using the "-X" parameter. For example you can send command "top" to a screen session "patching" to page 3 using : [code lang="text"] [oracle@sandbox ~]$ screen -S 6236.patching -p 3 -X 'top\r' [/code] I received some useful advice from my colleagues while I was writing this blog post. The first one was about using the option "-L" which enables output logging for your screen session. You can also enable it inside your screen pressing ctrl-a H. It may come handy if you want to see what was happening when you was detached from the session. The second piece of advice was about solution or workaround when your session cannot start when running on a pseudo tty : [code lang="text"] [otochkin@sandbox ~]$ su - oracle Password: [oracle@sandbox ~]$ screen Cannot open your terminal '/dev/pts/0' - please check. [oracle@bigdatalite ~]$ [/code] What you can do is to use the "script" command and redirect output to either "/dev/null" or to another location if you need it. [code lang="text"] [oracle@sandbox ~]$ script -c 'screen' /dev/null Script started, file is /dev/null [detached] Script done, file is /dev/null [oracle@sandbox ~]$ screen -ls There is a screen on: 30932.pts-1.sandbox (Detached) 1 Socket in /var/run/screen/S-oracle. [oracle@sandbox ~]$ [/code] The workaround may help you when you are connected to a server with personal account but need to create a screen session for the oracle user or for any other user you are switching to by the "su" command. As I've said, you can easily install the utility from your yum repository. But if you want the latest and greatest, you can try to download it from https://ftp.gnu.org/gnu/screen and compile by yourself. It may help if you hit a bug or find some new useful feature in the changelog for the latest version. When I was writing the blog the version in Red Hat repository was 4.0.1 vs 4.4.0 on gnu.org . I hope you will find this utility useful for you. Explore, enjoy, and stay tuned. In one of my next blogs I plan to write about another utility with similar options.
On this page
Share this
Share this
More resources
Learn more about Pythian by reading the following blogs and articles.
Explaining Azure Data Factory Mapping Data Flows – SQL On The Edge Episode 20

Explaining Azure Data Factory Mapping Data Flows – SQL On The Edge Episode 20
Jun 18, 2019 12:00:00 AM
2
min read
Analyze index validate structure - the dark side
Analyze index validate structure - the dark side
May 13, 2016 12:00:00 AM
10
min read
Datascape Podcast Episode 48: Recapping the Spring 2021 Microsoft Ignite Virtual Conference
Datascape Podcast Episode 48: Recapping the Spring 2021 Microsoft Ignite Virtual Conference
Apr 8, 2021 12:00:00 AM
2
min read
Ready to unlock value from your data?
With Pythian, you can accomplish your data transformation goals and more.