Sponsored Content
Top Forums Shell Programming and Scripting Script works, but I think it could be better and faster Post 303025780 by RudiC on Monday 12th of November 2018 09:05:01 AM
Old 11-12-2018
Your shell - which you failed to mention, BTW - should provide the -x (xtrace) option to print to stderr the commands / lines it is about to execute.
One option to accelerate the script would be to optimise the order in which the files are accessed / evaluated, and to drop the for loops. On top, there's no need to read the files' file again and again, if the files don't change with the respective servers. Read once and build the scp into a variable.Try something along

Code:
readarray FNARR < filesfile
while read SVNM
  do CHKDIR/MKDIR serverdir
     scp -options $SVNM/${FNARR[@]} serverdir
  done < serverfile

copying all target files from a single server in one go... This is an untested frame / pseudo code proposal, so YMMV.

Last edited by RudiC; 11-12-2018 at 11:21 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script works fine until I | more

Hello all, This beats me. I have a script that executes some commands and redirects their output to some text files that I will parse. The commands are along the lines of: dsmadmc -id=admin -pa=admin -outfile=/home/tools/qlog.txt q log f=d If I just run the script it works. If I execute... (2 Replies)
Discussion started by: Skovian
2 Replies

2. Shell Programming and Scripting

perl - how come this script works?

#!/usr/bin/perl open (DATA, file.txt); @array = <DATA>; close (DATA); open (DATA, ">$file.txt"); for (@array) { s/text/replace text/; push(@contents,$_); } seek(DATA, 0, 0); print DATA (@contents); close(DATA); could someone please explain how this works. i've been... (3 Replies)
Discussion started by: mjays
3 Replies

3. UNIX for Advanced & Expert Users

Country Codes script faster response ;please help

Dear all I have group of input lines which look like this These input lines is placed in a file named phonelines.txt and there is a script which match $4 and $5 with country codes placed in another file named country-codes.txt and its contents is : Italy 39 Libyana 21892 Thuraya... (12 Replies)
Discussion started by: zanetti321
12 Replies

4. Shell Programming and Scripting

Can anyone make this script run faster?

One of our servers runs Solaris 8 and does not have "ls -lh" as a valid command. I wrote the following script to make the ls output easier to read and emulate "ls -lh" functionality. The script works, but it is slow when executed on a directory that contains a large number of files. Can anyone make... (10 Replies)
Discussion started by: shew01
10 Replies

5. Shell Programming and Scripting

Script works with bash 3.0 but not 3.2.

Hello, So my knowledge of bash scripting is not that great and I have been trying to solve this problem on my own for awhile to no avail. Here's the error I get when running it with an OS that uses bash 3.2.x: testagain.sh: line 10: *-1: syntax error: operand expected (error token is... (2 Replies)
Discussion started by: forkandspoon
2 Replies

6. Shell Programming and Scripting

Script to parse a file faster

My example file is as given below: conn=1 uid=oracle conn=2 uid=db2 conn=3 uid=oracle conn=4 uid=hash conn=5 uid=skher conn=6 uid=oracle conn=7 uid=mpalkar conn=8 uid=anarke conn=1 op=-1 msgId=-1 - fd=104 slot=104 LDAPS connection from 10.10.5.6 to 10.18.6.5 conn=2 op=-1 msgId=-1 -... (7 Replies)
Discussion started by: sags007_99
7 Replies

7. Shell Programming and Scripting

Make script faster

Hi all, In bash scripting, I use to read files: cat $file | while read line; do ... doneHowever, it's a very slow way to read file line by line. E.g. In a file that has 3 columns, and less than 400 rows, like this: I run next script: cat $line | while read line; do ## Reads each... (10 Replies)
Discussion started by: AlbertGM
10 Replies

8. Shell Programming and Scripting

Making script run faster

Can someone help me edit the below script to make it run faster? Shell: bash OS: Linux Red Hat The point of the script is to grab entire chunks of information that concerns the service "MEMORY_CHECK". For each chunk, the beginning starts with "service {", and ends with "}". I should... (15 Replies)
Discussion started by: SkySmart
15 Replies

9. Shell Programming and Scripting

Optimize shell script to run faster

data.file: contact { contact_name=royce-rolls modified_attributes=0 modified_host_attributes=0 modified_service_attributes=0 host_notification_period=24x7 service_notification_period=24x7 last_host_notification=0 last_service_notification=0 host_notifications_enabled=1... (8 Replies)
Discussion started by: SkySmart
8 Replies

10. Shell Programming and Scripting

Shell script works fine as a standalone script but not as part of a bigger script

Hello all, I am facing a weird issue while executing a code below - #!/bin/bash cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset sh UKBA_publish.sh UKBA 28082015 3 if then echo "Param file conversion for all the areas are completed, please check in your home directory"... (2 Replies)
Discussion started by: ektubbe
2 Replies
DEBSIGN(1)						      General Commands Manual							DEBSIGN(1)

NAME
debsign - sign a Debian changes and dsc file pair using GPG SYNOPSIS
debsign [options] [changes-file|dsc-file|commands-file ...] DESCRIPTION
debsign mimics the signing aspects (and bugs) of dpkg-buildpackage(1). It takes either an unsigned .dsc file or an unsigned .changes file (along with the associated unsigned .dsc file found by replacing the architecture name and .changes by .dsc if it appears in the .changes file), and signs them using the GNU Privacy Guard. It is careful to calculate the size and checksums of the newly signed .dsc file and replace the original values in the .changes file. If a .changes, .dsc or .commands file is specified, it is signed, otherwise, debian/changelog is parsed to determine the name of the .changes file to look for in the parent directory. If a .commands file is specified it is first validated (see the details at ftp://ftp.upload.debian.org/pub/UploadQueue/README), and the name specified in the Uploader field is used for signing. This utility is useful if a developer must build a package on one machine where it is unsafe to sign it; they need then only transfer the small .dsc and .changes files to a safe machine and then use the debsign program to sign them before transferring them back. This process can be automated in two ways. If the files to be signed live on the remote machine, the -r option may be used to copy them to the local machine and back again after signing. If the files live on the local machine, then they may be transferred to the remote machine for sign- ing using debrsign(1). This program can take default settings from the devscripts configuration files, as described below. OPTIONS
-r [username@]remotehost The .changes and .dsc files live on the specified remote host. In this case, a .changes file must be explicitly named, with an absolute directory or one relative to the remote home directory. scp will be used for the copying. The [username@]remote- host:changes syntax is permitted as an alternative. Wildcards (* etc.) are allowed. -pprogname When debsign needs to execute GPG to sign it will run progname (searching the PATH if necessary), instead of gpg. -mmaintainer Specify the maintainer name to be used for signing. (See dpkg-buildpackage(1) for more information about the differences between -m, -e and -k when building packages; debsign makes no use of these distinctions except with respect to the precedence of the vari- ous options. These multiple options are provided so that the program will behave as expected when called by debuild(1).) -emaintainer Same as -m but takes precedence over it. -kkeyid Specify the key ID to be used for signing; overrides any -m and -e options. -S Look for a source-only .changes file instead of a binary-build changes file. -adebian-architecture, -tGNU-system-type See dpkg-architecture(1) for a description of these options. They affect the search for the .changes file. They are provided to mimic the behaviour of dpkg-buildpackage when determining the name of the .changes file. --multi Multiarch changes mode: This signifies that debsign should use the most recent file with the name pattern package_ver- sion_*+*.changes as the changes file, allowing for the changes files produced by dpkg-cross. --re-sign, --no-re-sign Recreate signature, respectively use the existing signature, if the file has been signed already. If neither option is given and an already signed file is found the user is asked if he or she likes to use the current signature. --debs-dir DIR Look for the .changes and .dsc files in directory DIR instead of the parent of the source directory. This should either be an abso- lute path or relative to the top of the source directory. --no-conf, --noconf Do not read any configuration files. This can only be used as the first option given on the command-line. --help, -h Display a help message and exit successfully. --version Display version and copyright information and exit successfully. CONFIGURATION VARIABLES
The two configuration files /etc/devscripts.conf and ~/.devscripts are sourced in that order to set configuration variables. Command line options can be used to override configuration file settings. Environment variable settings are ignored for this purpose. The currently recognised variables are: DEBSIGN_PROGRAM Setting this is equivalent to giving a -p option. DEBSIGN_MAINT This is the -m option. DEBSIGN_KEYID And this is the -k option. DEBSIGN_ALWAYS_RESIGN Always re-sign files even if they are already signed, without prompting. DEBRELEASE_DEBS_DIR This specifies the directory in which to look for the .changes and .dsc files, and is either an absolute path or relative to the top of the source tree. This corresponds to the --debs-dir command line option. This directive could be used, for example, if you always use pbuilder or svn-buildpackage to build your packages. Note that it also affects debrelease(1) in the same way, hence the strange name of the option. SEE ALSO
debrsign(1), dpkg-buildpackage(1), dpkg-architecture(1), debuild(1), md5sum(1), sha1sum(1), sha256sum(1), gpg(1), scp(1) and devscripts.conf(5). AUTHOR
This program was written by Julian Gilbey <jdg@debian.org> and is copyright under the GPL, version 2 or later. DEBIAN
Debian Utilities DEBSIGN(1)
All times are GMT -4. The time now is 06:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy