LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-06-2018, 05:44 AM   #1
Cuuky
LQ Newbie
 
Registered: Aug 2018
Posts: 1

Rep: Reputation: Disabled
Shell screen problem


Hey,

im a starter in writing shell scripts so please be kind ^^
My problem:
I wrote 2 shell script which starts a jar in a screen.
Then i wanted to start this 2 screens with one script.
The script runs, but the screen doesn't open.
Yes, i could instead of running the other scripts in a seperate file just paste the code in the main shell file but then the jar wouldn't run in the right folder.
If run the scripts manually everything works.

Here the code of the 2 shell scripts:
PHP Code:
#!/bin/bash
screen -S Master --m java -jar "Cloudy Master 0.1.2-obf.jar" 
PHP Code:
#!/bin/bash
screen -S Wrapper --m java -jar "Cloudy Wrapper 0.1.2-obf.jar" 
The Main Script
PHP Code:
#!/bin/bash
/home/Cloud/Master/startMaster.sh
sleep 5
/home/Cloud/Wrapper/startWrapper.sh 
*Yes, i did check the permissions of the files*

Thank you in advance
 
Old 08-06-2018, 06:22 AM   #2
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,171
Blog Entries: 3

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
I think you can do it in the main script itself and won't need to call other scripts. It may matter that you use the full paths to the programs though:

Code:
/usr/bin/screen -S Master -d -m -- /usr/bin/java -jar "Cloudy Master 0.1.2-obf.jar"  
/usr/bin/screen -S Wrapper -d -m -- /usr/bin/java -jar "Cloudy Wrapper 0.1.2-obf.jar"
Using the double dash -- tells screen not to pay interpret any more options. So then the rest is passed on to the screen session.

Then you can reconnect:

Code:
screen -dRR -S Master
or

Code:
screen -dRR -S Wrapper
All that assumes that the java program is running.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Login shell greater than screen spiri13 Linux - Newbie 8 08-25-2016 03:10 PM
How to display the results of a command screen by screen in a shell? Linux-at-last Linux - Newbie 4 03-09-2014 04:41 PM
Problem: Youtube video screen - Shockwave flash - White screen. Firefox. NOoBuntuLinux Ubuntu 5 04-29-2010 08:44 PM
LTSP - Bash Shell Screen waddy Linux - Server 1 01-24-2009 10:34 PM
Text Shell Login Welcome Screen Help tag Linux - Desktop 2 01-07-2007 07:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration