Sponsored Content
Top Forums Shell Programming and Scripting For loop scp transfers check if all iterations successful Post 302413342 by markdjones82 on Thursday 15th of April 2010 09:53:30 AM
Old 04-15-2010
Quote:
Originally Posted by jgt
I don't see the "done" line in your script, but if you start a new $LOGFILE with each run, you could add
Code:
mailx -s "SCP Results" john.doe <$LOGFILE
cat $LOGFILE >>BIGLOGFILE

after the done statement
Yeah these people are picky and would only want to be emailed IF any of the iterations failed. I don't want to email the log on each iteration though.

I think i am going to make a variable in the else statement. like set FAILED=0
if command not successful increment failed and then email if failed does not equal 0
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

For Loop iterations

I have a silly beginners question here: I'm running a for loop within an awk command as follows, however the loop only runs once, instead of 2 through to 11 and then terminating. As the output to screen of x (line 6) shows x to equal 12, when it should be 1. --------------------------- awk... (2 Replies)
Discussion started by: sirtrancealot
2 Replies

2. UNIX for Advanced & Expert Users

SCP / SFTP successful but locks out target account

Hi, We have an interesting problem with F-Secure SSH (v 3.1.0) running on HP-UX. It seems that when scp or sftp commands are issued they are successful but it counts as a 'strike' against the target user locking the account out after 3 attempts. When the user is re-enabled in SAM - it reports... (4 Replies)
Discussion started by: b0bbins
4 Replies

3. UNIX for Dummies Questions & Answers

probloem in scp command 99% content only transfers

hi every one.. i am new to working in unix environment.. i have a problem in transferring files using scp command.. i am transferring files using scp command on one unix manchine to another unix machine.. the syntax is scp -r sourcedirectory destination directory The files in sourcedirectory... (1 Reply)
Discussion started by: GovindGembali
1 Replies

4. Cybersecurity

automatic SCP transfers issues

Hi, I'm trying to set up scp but it isn't as nice as WinSCP. My requirement is to transfer a file from one machine to another with scp. This would run in a .ksh so it would need to avoid prompts (password/are you sure). First I tried this with v2: SSH with Keys HOWTO: SSH with Keys in a console... (1 Reply)
Discussion started by: Dird
1 Replies

5. Shell Programming and Scripting

rm files after testing for successful scp

First off, I know this is sort of a rehash of similar questions that have been asked in other closed threads, but I haven't been able to figure out how to apply the answers provided in those threads to my scenario and make it work. I am working on a script in KSH on AIX 5.1 that will do a bulk... (1 Reply)
Discussion started by: derndingle
1 Replies

6. Homework & Coursework Questions

Script to check transfer was successful

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a script that performs a post processing action: The run time environment of the script has the... (2 Replies)
Discussion started by: kenrowe
2 Replies

7. Shell Programming and Scripting

How to check if the merge of two files is successful?

Hi All, I have a requirement to check if the merge of files is successful or not. The script to merge files goes like this, cat Rewards_Header Rewards_Siebel_Notif_temp Rewards_Siebel_Remind105_temp > Rewards_Siebel Sometimes, the file Rewards_Siebel misses records from file... (5 Replies)
Discussion started by: anandek
5 Replies

8. Shell Programming and Scripting

How to check whether the sftp script is successful??

hi, how can i check whether the sftp connectivity is successful or not?? i am using expect script to connect to sftp.. sftp_script spawn /usr/bin/sftp abc@ftp.xyz.com expect "abc@ftp.xyz.com's password:" send "password\r" expect "sftp>" send "mput *.txt\r" expect "sftp>" send "bye\r"... (8 Replies)
Discussion started by: Little
8 Replies

9. Shell Programming and Scripting

Scp/Rsync transfers stopped working?

Hi all, I have a backup script from my work computer to my home computer for my research for multiple reasons. It's a simple rsync script, with about 5 gigs of data. (Obviously with rsync it doesn't transfer 5 GB every time.). Recently, it has stopped working, scp also doesn't work, it simply... (1 Reply)
Discussion started by: corrado33
1 Replies

10. Shell Programming and Scripting

Store 'for' loop iterations in memory

hi all, I'm writting a simple bash script to do a recursive paste over >10000 files with two columns each. The files looks like this: A1BG 3 A1CF 3 A2M 3 A4GALT 5 AAAS 2 AACS 2 AADAT 2 AAGAB 4 AAK1 3 AAMP 2 AANAT 3 AARS 2 AARS2 3 AARSD1 ... (1 Reply)
Discussion started by: lsantome
1 Replies
dispatch_apply(3)					   BSD Library Functions Manual 					 dispatch_apply(3)

NAME
dispatch_apply -- schedule blocks for iterative execution SYNOPSIS
#include <dispatch/dispatch.h> void dispatch_apply(size_t iterations, dispatch_queue_t queue, void (^block)(size_t)); void dispatch_apply_f(size_t iterations, dispatch_queue_t queue, void *context, void (*function)(void *, size_t)); DESCRIPTION
The dispatch_apply() function provides data-level concurrency through a "for (;;)" loop like primitive: size_t iterations = 10; // 'idx' is zero indexed, just like: // for (idx = 0; idx < iterations; idx++) dispatch_apply(iterations, DISPATCH_APPLY_AUTO, ^(size_t idx) { printf("%zu ", idx); }); Although any queue can be used, it is strongly recommended to use DISPATCH_APPLY_AUTO as the queue argument to both dispatch_apply() and dispatch_apply_f(), as shown in the example above, since this allows the system to automatically use worker threads that match the configura- tion of the current thread as closely as possible. No assumptions should be made about which global concurrent queue will be used. Like a "for (;;)" loop, the dispatch_apply() function is synchronous. If asynchronous behavior is desired, wrap the call to dispatch_apply() with a call to dispatch_async() against another queue. Sometimes, when the block passed to dispatch_apply() is simple, the use of striding can tune performance. Calculating the optimal stride is best left to experimentation. Start with a stride of one and work upwards until the desired performance is achieved (perhaps using a power of two search): #define STRIDE 3 dispatch_apply(count / STRIDE, DISPATCH_APPLY_AUTO, ^(size_t idx) { size_t j = idx * STRIDE; size_t j_stop = j + STRIDE; do { printf("%zu ", j++); } while (j < j_stop); }); size_t i; for (i = count - (count % STRIDE); i < count; i++) { printf("%zu ", i); } IMPLIED REFERENCES
Synchronous functions within the dispatch framework hold an implied reference on the target queue. In other words, the synchronous function borrows the reference of the calling function (this is valid because the calling function is blocked waiting for the result of the synchro- nous function, and therefore cannot modify the reference count of the target queue until after the synchronous function has returned). This is in contrast to asynchronous functions which must retain both the block and target queue for the duration of the asynchronous opera- tion (as the calling function may immediately release its interest in these objects). FUNDAMENTALS
dispatch_apply() and dispatch_apply_f() attempt to quickly create enough worker threads to efficiently iterate work in parallel. By con- trast, a loop that passes work items individually to dispatch_async() or dispatch_async_f() will incur more overhead and does not express the desired parallel execution semantics to the system, so may not create an optimal number of worker threads for a parallel workload. For this reason, prefer to use dispatch_apply() or dispatch_apply_f() when parallel execution is important. The dispatch_apply() function is a wrapper around dispatch_apply_f(). CAVEATS
Unlike dispatch_async(), a block submitted to dispatch_apply() is expected to be either independent or dependent only on work already per- formed in lower-indexed invocations of the block. If the block's index dependency is non-linear, it is recommended to use a for-loop around invocations of dispatch_async(). SEE ALSO
dispatch(3), dispatch_async(3), dispatch_queue_create(3) Darwin May 1, 2009 Darwin
All times are GMT -4. The time now is 06:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy