Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7725391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:55:32+00:00 2026-06-01T04:55:32+00:00

I have been trying to write a custom .screenrc file TEST as follows startup_message

  • 0

I have been trying to write a custom .screenrc file TEST as follows

startup_message off
vbell off
caption always "%{= bb}%{+b w}%n %h %=%t %c"
hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
activity "Activity in %t(%n)"
shell -/bin/bash
chdir /path1
screen -t WINDOW1 bash -c 'MYSCRIPT1'
chdir /path2
screen -r WINDOW1 bash -c 'MYSCRIPT2'

I am running this script as follows

screen -c TEST

What I am trying to achieve is execute a screen command that spawns two windows in two different directory paths and in each of them two different commands/scripts should be run.

but using this code my screen immediately terminates which is the default behavior.

I want that screen windows should not be terminated rather they should come back to the directory path1 directory path2 respectively once the command terminates in each of these screen windows.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T04:55:34+00:00Added an answer on June 1, 2026 at 4:55 am

    I resolved this as follows. Written a startup script called STARTSCRIPT with below content

    screen -d -m -S SESSIONNAME
    
    screen -X -S SESSIONNAME -p 0 -t WINDOW0
    screen -X -S SESSIONNAME screen -t WINDOW1 1
    
    echo "Trying to start memcached...."
    screen -X -S SESSIONNAME -p 1 stuff "memcached
    "
    echo 'Memcached started....'
    
    echo "Trying to start MYSCRIPT1...."
    screen -X -S SESSIONNAME screen -t MYSCRIPT1 2
    screen -X -S SESSIONNAME -p 2 stuff "cd /path1; ./MYSCRIPT1
    "
    echo 'MYSCRIPT1 started....'
    
    echo "Trying to start MYSCRIPT2...."
    screen -X -S SESSIONNAME screen -t MYSCRIPT2 3
    screen -X -S SESSIONNAME -p 3 stuff "cd /path2; ./MYSCRIPT2
    "
    echo 'MYSCRIPT2 started....'
    

    It is important to note double quotes(“) on the next line of the command, without it command will not execute.

    Also I moved screen hard status settings to its own ~/.screenrc file so that every screen window created looks like a tab inside screen session.

    startup_message off
    vbell off
    caption always "%{= bb}%{+b w}%n %h %=%t %c"
    hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
    activity "Activity in %t(%n)"
    shell -/bin/bash
    

    I executed the STARTSCRIPT as follows

    $./STARTSCRIPT
    

    It gave me the desired output of running commands in their own screen window and these window do not terminate even after the command finishes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have been trying to write an awk script which processes a log file, but
I have been trying to write to a file,but it kept writing them on
I have been trying to write a small app with its own option windows.
I have been trying to write a bare-bones ping scanner using Perl for internal
I have been trying to write an image on a layer using Quartz but
I have been trying to write my own diff3 wrap script for SVN and
I have been trying to write a regex that will remove whitespace following a
I have been trying to write a shortest path algorithm, dijkstras algorithm, finding the
I am new to programming. I have been trying to write a function in
Right now I have been trying to use Launchpad's API to write a small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.