Script running from another script issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script running from another script issue
# 1  
Old 07-29-2011
Script running from another script issue

Hello All,

I am ruuning the below script.

userchecking.sh
###########################
Code:
#! /bin/ksh
NIS_SCRIPT_HOME="/mot/systems/NIS_SCRIPT_NEW"
. $NIS_SCRIPT_HOME/common.env
WORK_DIR="/mot/systems/scripts/"
#WORK_DIR="/mot/b36376/myscripts/nis_user_automation"
NIS_SERVER="cde-zin10-tta02"
AREA_DETAIL_FILE=$WORK_DIR/user.txt
CURR_TIME=`date +%m-%d-%Y-%R`
cd $WORK_DIR

cat $AREA_DETAIL_FILE|grep -v "^#">/tmp/users_tmp

while read inputline
do

    echo "creating NIS User account"
    echo $inputline
#     /mot/systems/NIS_SCRIPT_NEW/make_nis_account_ankit.sh $inputline
     env>>/tmp/ankit2
     /mot/systems/NIS_SCRIPT_NEW/make_nis_account_ankit.sh b10873
     echo $inputline
   perl -i -wnl -e '/^('$inputline')/ and print "#$1 - CREATED on '$CURR_TIME'" or print' $AREA_DETAIL_FILE

done</tmp/users_tmp


rm /tmp/users_tmp

#################################

Its calling another script make_nis_account_ankit.sh & passing a parameter.The strange thing i see is when i am running make_nis_account_ankit.sh independently its running fine but when i am calling from userchecking.sh it throwing syntax errors.
I am running both the scripts as sudo.

Can anyone help me out in this why its happening.

Regards

Ankit

Last edited by pludi; 07-29-2011 at 08:04 AM..
# 2  
Old 07-29-2011
If make_nis_account_ankit.sh is not executable or lacks a valid first line #!, then the sh will process it as stdin, see man execvp.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issue with running a script via ssh

Hi, I'm trying to run a user defined shell script with options and arguments via ssh but getting error as ksh: Script.sh: not found. Here is what i'm running: ssh -t username@server 'cd /path/to/script; script.sh -t start here '-t' with script.sh, is an user defined option and 'start' is also... (3 Replies)
Discussion started by: xsam
3 Replies

2. Shell Programming and Scripting

Issue with running commands from shell script

I'm trying to copy files from a remote windows server to Unix server. I was successfully able to copy files from windows server using command prompt but when I run these commands from a script it's not working as expected. commands used: sftp user@remoteserver.com lcd local_dir cd... (3 Replies)
Discussion started by: naresh7590
3 Replies

3. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

4. Shell Programming and Scripting

Shell Script for continuously checking status of a another script running in background, and immedia

Hi, I want to write a script which continuously checking status of a script running in background by nohup command. And if same script is not running then immediately start the script...please help.. i am using below command to run script nohup system_traps.sh & but in some... (9 Replies)
Discussion started by: ketanraut
9 Replies

5. Shell Programming and Scripting

Shell scripting issue-running the background script

I have written the below query to genrate a telephone.I am passing account number from oracle database. I am calling 2 scripts which generate the bill 1. bip.sh (it runs in the background) 2.runXitInvoice_PROFORMA_integ bip.sh generates a number which runXitInvoice_PROFORMA_integ uses.How... (7 Replies)
Discussion started by: rafa_fed2
7 Replies

6. Shell Programming and Scripting

Issue in running shell script in crontab

I'm having a shell script which has to be run only once at the specified time. Shell script is like following, #!/bin/bash db2 connect to XXX > connection_status.txt This script is scheduled in crontab as following, 50 4 8 5 0 sh script.sh scheduled script is run at the specified time... (1 Reply)
Discussion started by: Rajkumar Gandhi
1 Replies

7. Shell Programming and Scripting

Issue running script as root

1) Environment:Red Hat Linux, bash shell Script to be run owned by user :myUser Home environment of myUser: pathto/home 2) ESP agent with root access will run JobXXX.sh su - myUser -c "/pathto/home/bin/script.sh" where script.sh has some echo statements and an exit statement in the end... (4 Replies)
Discussion started by: cj09
4 Replies

8. AIX

AIX - "prevent script from running twice" issue

I know about standard "ps ..|grep .. | grep -v grep" solution, but... this is different issue I have encountered in several companies I worked for. And I see this only for AIX - not HP, not Solaris, not Linux. Korn shell script is scheduled in the background (via cron /via Tivoli Scheduler or... (6 Replies)
Discussion started by: ooops
6 Replies

9. Shell Programming and Scripting

issue with running script with crontab

I am facing a strange issue while running a script(eg A) from the crontab entry the script calls one more script(eg B) within it now when i run the script A manually(with nohup) it also executes the script B (embedded inside it) as expected. but when i run the script A from the crontab entry... (7 Replies)
Discussion started by: mad_man12
7 Replies

10. Shell Programming and Scripting

Facing issue in Solaris OS in crontab for running shell script

Hello i have a shell script. it is running fine when i manually run at command prompt using following command ./script_file but while running shell script from crontab, it is giving error in each line. (2 Replies)
Discussion started by: mabrar
2 Replies
Login or Register to Ask a Question