Sponsored Content
Full Discussion: Achive "NOT RUN PARALLEL"
Top Forums Shell Programming and Scripting Achive "NOT RUN PARALLEL" Post 302880834 by jim mcnamara on Monday 23rd of December 2013 11:59:48 PM
Old 12-24-2013
You are trying to set up something that allows process synchronization. This is usually achieved using some kind of IPC mechanism (Inter-process communication). You can use a lockfile.

Let's have three scripts: SA, SB, SC. you need to have a shell function or a bit of code to implement this. It is easier to control if each process uses PRECISELY the same mechanism to control its successors. Consider a lockfile.

crontab: run all three scripts at 2:20 am (example)

Code:
19 2 * * *  > /path/to/lockfile && echo 'startSA' > /path/to/lockfile
20 2 * * *  /path/to/SA >   /path/to/logfile
21 2 * * *  /path/to/SB >> /path/to/logfile
22 2 * * *  /path/to/SC >> /path/to/logfile

SA:
Code:
export start_parm='startSA'
while true
do
   grep -q "$start_parm" /path/to/lockfile
   [ $?  -eq 0 ]  && break
   sleep 1
done
# script code goes here
# ....
# ....
#
# last line of code:
echo 'startSB' > /path/to/lockfile
exit

SB:
Code:
export start_parm='startSB'
while true
do
   grep -q "$start_parm" /path/to/lockfile
   [ $?  -eq 0 ]  && break
   sleep 1
done
# script code goes here
# ....
# ....
#
# last line of code:
echo 'startSC' > /path/to/lockfile
exit

SC:
Code:
export start_parm='startSC'
while true
do
   grep -q "$start_parm" /path/to/lockfile
   [ $?  -eq 0 ]  && break
   sleep 1
done
# script code goes here
# ....
# ....
#
# last line of code:
echo 'endALL' > /path/to/lockfile
exit

This User Gave Thanks to jim mcnamara For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Run away "bootpgw" & "inetd"

Hello All. I'm get the following messages posted to the /var/adm/syslog file ever second and not sure on how to stop the process. May 14 15:50:52 a3360 bootpgw: version 2.3.5 May 14 15:50:52 a3360 inetd: /etc/bootpgw exit 0x1 As said about this gets logged every second only thing that... (4 Replies)
Discussion started by: cfaiman
4 Replies

2. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

3. Shell Programming and Scripting

catalina.sh : need combination from "start" and "run"

heya, can someone help me with following problem. i am not sure how far you know the catalina.sh script from tomcat. when i start my tomcat with "catalina.sh run" then the startup-process-output will be printed out on the console, but the tomcat process is started in current shell/session, so... (1 Reply)
Discussion started by: Filly
1 Replies

4. UNIX for Dummies Questions & Answers

Slow printing / CUPS - process "parallel" high cpu

Hello. I have a slackware system running cups with an HP laserJet 2100 connected via parallel port in ECP mode. Print jobs are working. Very slowly. 15K test print out of cups takes about 2 minutes to complete. When the printout is on the way to the printer, the process "parallel" uses... (0 Replies)
Discussion started by: agentrnge
0 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

7. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

8. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

9. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
All times are GMT -4. The time now is 04:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy