Sponsored Content
Top Forums Shell Programming and Scripting How to block first bash script until second bash script script launches web server/site? Post 303027204 by siegfried on Monday 10th of December 2018 09:05:57 PM
Old 12-10-2018
How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need.

I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes.

I'm using Cygwin bash on Windows 10.

My compileDeployStartWebServer.sh compiles the java code and starts the web server on port 8080.

Presently, the "StartBrowser.sh" sleeps for 40 seconds and launches a browser like Chrome or Firefox while the "compileDeployStartWebServer.sh" downloads any dependencies using maven or gradle, compiles the code and starts the web server. This takes a while!

So my plan was to enhance the java startup code in the web site to write "starting" to a UDP socket on port 7777. Alternatively, the java startup code could spawn a new child thread to write "starting" to a TCP socket so it the web site startup code won't block on the TCP socket in case I decide to run without the "StartBrowser.sh" script.

So is there a way to enhance the "StartBrowser.sh" to block on the TCP (or UDP) socket instead of sleeping? I could write some more java code, I suppose.

What would you recommend? UDP? TCP? What could I use to block the "StartBrowser.sh" (besides more custom java code) while the other script is busy downloading dependencies, compiling, deploying and starting the web server? flock?, exec? netcat? socat? something else?

Perhaps I should be using mutexes or semaphores instead? I don't think java has good support for these features, however.

Thanks
Siegfried

Last edited by siegfried; 12-10-2018 at 10:25 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script pass sentence in block

Hello, I want to know is it possible to pass a block of sentence using bash. For example, I have a script called Test.sh that takes in $1 and $2. and I'm calling Test.sh in a.sh so in a.sh Test.sh '' 'This is a sentence' Because block are separated by space so when I do that, I get... (6 Replies)
Discussion started by: katrvu
6 Replies

2. Shell Programming and Scripting

(w)get web server's directories + bash script

Hi everyone. I need to write a script which will download files/folders (a huge collection) to the local file server (centOS 4.4 Server), and check regularly (every 6 hours or so if any new files are present, or if the old ones were modified to update contents). Any insights on how to tackle... (2 Replies)
Discussion started by: reminiscent
2 Replies

3. Shell Programming and Scripting

Help with bash script to block IP addresses

I am using a bash script for CentOS 5.5, I found one and modified it, however I want to block the incoming IP addresses and ALLOW the IP addresses that are blocked to send out email. I will use an internal network range for an example, 10.10.10.0/24 (if a lot of spam is incoming) from this range... (0 Replies)
Discussion started by: grifs71
0 Replies

4. Shell Programming and Scripting

Bash script to test IP range on server

Hello, We have to configure servers with a range of IPs which is in itself a subject for another script assistance request -but- we have run into quite a few IP ranges with routing problems lately. I've been trying to figure out the best way to test a range of IPs, I mean, manually it's not... (4 Replies)
Discussion started by: boxgoboom
4 Replies

5. Shell Programming and Scripting

need help with little bash server monitor script

hello, i`m new in bash scripting and i getting an error with my little server monitoring script example of my script: #!/bin/sh s1_ats=0 while ; do sleep 5 s1=`ping -c 1 xxxx.xxxx.xxxx.xxxx | grep 64 | awk '{print $1}'` if ; then $s1_ats=0 else if ; then (2 Replies)
Discussion started by: grauzikas
2 Replies

6. Shell Programming and Scripting

Block local and remote port with iptables - Script BASH

Hello I'm beginner in the linux scripting and i would like to get help. I want to create a script that can block one or more Port even see all the TCP port. The ports must be blocked even when starting my machine. Of course requires a second script which will allow the ports that you want to... (0 Replies)
Discussion started by: houstaf
0 Replies

7. Shell Programming and Scripting

Bash script and remote server issue

Hello, I'm attempting to run a script on a remote server via SSH but am having issues getting the script to run using proprietary binaries located on the remote server as it keeps complaining that commands are invalid on the local machine. If I run the script locally on the remote server, it... (2 Replies)
Discussion started by: shadyuk
2 Replies

8. UNIX for Dummies Questions & Answers

Running a C/C++ program and/or bash script from a server

I wish to be able to give to a client the opportunity to : 0) Turn one of my ubuntu computers into a webserver 1) See a webpage after visiting a url where an external user/client can set a couple of variables (e.g. Number1= ?, Number2=?) 2) By pressing "run" the program runs on my machine 3)... (1 Reply)
Discussion started by: frad
1 Replies

9. Shell Programming and Scripting

Transfer files from one server with bash script

Hello to all, I want to copy from one server to another files of last 24 hours with size between 500MB and 2GB. The code below searches last files in 24 hours. find . -mtime -1 In order to copy faster I'd like to compress the files before copying them. How to automate the process of... (8 Replies)
Discussion started by: Ophiuchus
8 Replies

10. Shell Programming and Scripting

Refresh web page in bash script

hello, I am trying to refresh my web page which is created in bash script. I have a HTML page which when press a button calls a bash script. this bash script created the same page with dynamic data. When pressing the button I am calling to a function that set time out of 7 seconds and and after... (1 Reply)
Discussion started by: SH78
1 Replies
SIEVESHELL(1)						User Contributed Perl Documentation					     SIEVESHELL(1)

NAME
sieveshell - remotely manipulate sieve scripts SYNOPSIS
sieveshell [--user=user] [--authname=authname] [--realm=realm] [--exec=script] server[:port] sieveshell --help DESCRIPTION
sieveshell allows users to manipulate their scripts on a remote server. It works via MANAGESIEVE, a work in progress. The following commands are recognized: list list scripts on server. put <filename> upload script to server. get <name> [<filename>] get script. if no filename display to stdout delete <name> delete script. activate <name> activate script. deactivate deactivate all scripts. OPTIONS
-u user, --user=user The authorization name to request; by default, derived from the authentication credentials. -a authname, --authname=authname The user to use for authentication (defaults to current user). -r realm, --realm=realm The realm to attempt authentication in. -e script, --exec=script Instead of working interactively, run commands from script, and exit when done. REFERENCES
[MANAGESIEVE] Martin, T.; "A Protocol for Remotely Managing Sieve Scripts", draft-ietf-managesieve-03.txt, Mirapoint, Inc.; May 2001, work in progress. AUTHOR
Tim Martin <tmartin@mirapoint.com>, and the rest of the Cyrus team <cyrus-bugs@andrew.cmu.edu>. perl v5.10.0 2008-04-04 SIEVESHELL(1)
All times are GMT -4. The time now is 07:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy