how to control the exec sequence of subshell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to control the exec sequence of subshell
# 1  
Old 06-15-2009
how to control the exec sequence of subshell

I have a proc like this.

main.sh
Code:
echo "#######################################starts"
echo "Task begins at" `date`
shell1.sh
wait
shell2.sh 
echo "####################################### ends"

I want to execute these shells in order within crontab control.
But sometimes it runs like this.the result is as below according to the ouput.

Code:
######################################### starts
Task begins at Mon Jun 15 14:48:00 CST 2009
######################################### ends

It did't run shell1 and shell2.sh at all.If I use "bash main.sh", it can run in sequence.

anyone knows why?

Thanks!
# 2  
Old 06-15-2009
can you post our crontab entry??
# 3  
Old 06-15-2009
If shell.1 &* shell.2 are not executable files you have to make them executable by using the command :-

chmod 755 filename

if they are already executable then use :-
sh main.sh to run the proc. or make it executable

BR
# 4  
Old 06-15-2009
Thanks for replys.
this is my crontab entry code.

Code:
*/10 * * * * main.sh >> crontab_task.log

# 5  
Old 06-15-2009
Always try to give the complete path of the script and log file as well.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Executing a command in subshell

Hi All, I am trying to create a shell script which runs on my linux machine. The requirement is so that, ade createview xyz -> this steps creates a view ade useview xyz -> we are entering inside the view ade begintrans -> begin a transaction My script has following code : lets say... (2 Replies)
Discussion started by: Dish
2 Replies

2. Shell Programming and Scripting

find common entries and match the number with long sequence and cut that sequence in output

Hi all, I have a file like this ID 3BP5L_HUMAN Reviewed; 393 AA. AC Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3; DT 05-FEB-2008, integrated into UniProtKB/Swiss-Prot. DT 05-JUL-2004, sequence version 1. DT 05-SEP-2012, entry version 71. FT COILED 59 140 ... (1 Reply)
Discussion started by: manigrover
1 Replies

3. Shell Programming and Scripting

Script Variables Inquiry, Values Okay in Standalone Exec, No-Show in Cron Exec

I have the following bash script lines in a file named test.sh. #!/bin/bash # # Write Date to cron.log # echo "Begin SSI Load $(date +%d%b%y_%T)" # # Get the latest rates file for processing. # d=$(ls -tr /rms/data/ssi | grep -v "processed" | tail -n 1) filename=$d export filename... (3 Replies)
Discussion started by: ginowms
3 Replies

4. Shell Programming and Scripting

Basename in subshell

Hi All, I would like to improve my bash scripting skill and found a problem which I do not understand. Task is to search and print files in directory (and subdirecories) which contains its own name. Files can have spaces in name. This one works fine for files in main directory, but not for... (4 Replies)
Discussion started by: new_item
4 Replies

5. Shell Programming and Scripting

While loop subshell problem

Hi, I have the below script while true; do read -p "Please enter schema password: " -s -e pswd1 echo read -p "Please retype schema password: " -s -e pswd2 echo && { echo -e "password mismatch.\n"; continue; } validateOraclePassword $pswd1... (2 Replies)
Discussion started by: varu0612
2 Replies

6. Shell Programming and Scripting

getopts in a subshell

Hello, I've a little problem with one of my ksh scripts and I manage to narrow it to the script here: #!/bin/ksh writeLog() { paramHandle="unknown" OPTIND=1 while getopts :i: option $* do case $option in i) paramHandle=${OPTARG} ;; esac done echo... (2 Replies)
Discussion started by: Dahu
2 Replies

7. Shell Programming and Scripting

Killing a subshell

I am calling a script from with another script and reading its output one line at a time (using <childscript> | while read line) in the parent script. If the output exceeds a predefined number of lines I want to kill the child shell from within the parent shell. I decided to print the process ID... (2 Replies)
Discussion started by: slash_blog
2 Replies

8. Shell Programming and Scripting

Subshell Question

The profile of the user is empty. Then before I run the script I want I run a parameter file that populates the variables for oracle. ORACLE_HOME ORACLE_BASE ORACLE_SID PATH etc ... But it seems that these variables are not making it to the shell I am in because when I do an echo on... (6 Replies)
Discussion started by: lesstjm
6 Replies

9. UNIX for Dummies Questions & Answers

Sending control sequence to printer before job

I am having difficulty sending a control sequence ESC&l5H (print to middle tray) to a HP printer (lp4).It is ignoring the command. I am using the following syntax in an executable file : echo "'/033'&l5H" > /dev/lp4 lp -dlp4 filename a) Is /033 'escape' ? b) What is the correct syntax ? (5 Replies)
Discussion started by: ianc
5 Replies
Login or Register to Ask a Question