![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Running script in background | shahnazurs | UNIX for Advanced & Expert Users | 3 | 06-04-2009 01:26 AM |
| Running the Script in Background. | prabhutkl | UNIX for Dummies Questions & Answers | 2 | 05-13-2009 12:44 AM |
| How to stop the script which is running in background | Prateek007 | Shell Programming and Scripting | 3 | 11-23-2008 05:54 AM |
| differences in calling another script inside script | balareddy | Shell Programming and Scripting | 1 | 11-06-2008 11:59 AM |
| calling a C executable from inside a Perl script | mark_nsx | Shell Programming and Scripting | 3 | 10-07-2005 05:49 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Running a unix script(which is calling another script inside that) in background
Hi all,
I am having a script ScriptA which is calling a script ScriptB in the same server and copying files to second server and have to execute one script ScriptC in the second server. THis First script ScriptA is the main script and i have to execute this process continously. for Keeping this script as background how is it possible.????? The Script A is having scp command and ScriptB is using SSH command and Script A is continously watching for events in ServerA. SO for running this continous looop which is using all these 3 scripts what is the method. I have tried nohup . but in that all the 3 scripts i have to do nohup ??? Crontab ?? i have tried but was not able to do the required result. i m using expect for sending password in scp and if i execute in background it is exiting and scripts are not functioning. Please Help me out for solving this issue Unix Experts. Thanking you all in advance Regards, Rohith G |
|
||||
|
Running a unix script(which is calling another script inside that) in background
Hi ,
I have one main script called script1.sh which contains the cotennts below. this script wil search for the existence of files in a particular directory and if one file is finidin it wil send to another server . this is the basic functionality the script1.sh is given below #Al the directiory locations wil be mentinedin the first # Trace output function trace () { if [ $TRACE ] then DATE=`date +"%Y-%m-%d %X"` echo "$DATE: $1" >> $TRACEFILE fi } trace "Script $0 started" # First find all alarm files to import at start FILES="`find $ALARM_FILES_DIR -type f`" # Loop forever and import files while [ true ] do loop=`expr $loop + 1` # cat the files to a text file if [ "$FILES" != "" ] then FILES_SORTED="`ls -rt $FILES`" trace "Alarm files to import:\n$FILES_SORTED" for i in $FILES_SORTED do cat $i>export1.txt username=*** password=*** expect -c " # exp_internal 1 # uncomment for debugging spawn /usr/bin/scp export1.txt ***@ipaddress:/location expect { "*password:*" { send $password\r\n; interact } eof { exit } } exit " /export/home/netcool/rohith/script.sh rm -rf export1.txt echo done LATEST="$i" SENDHB=false else trace "No new alarm files to import" SENDHB=true fi trace "Latest alarm file imported: $LATEST" # # If the latest file sent still exists then find newer files, otherwise find all files if [ -f "$LATEST" ] then FILES="`find $ALARM_FILES_DIR -newer $LATEST -type f`" else FILES="`find $ALARM_FILES_DIR -type f`" fi # Modify sleep time (in seconds) as needed below sleep 2 done THIS SCRIPT WIL CALL THE SECOND SCRIPT CALLED SCRIPT.SH contents given below since expect cant used inside the first script i hav given like dat in dif script i mean /usr/bin/expect -f #!/usr/local/bin/expect -f spawn ssh ***@ipaddrss 'location/ssh.sh' expect "password:" send "netcool\n" interact This wil call another script in server2 called ssh.sh contents are given below #!/bin/sh cat export1.txt >> export.txt rm export1.txt I need to execute all these 3 scripts in crontab for copyn the files automatically. I am really a beginner in scripting. I know some logical mismatch may be der . PLease correct me and help me out for solving this. REgards, ROhith G |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|