Sponsored Content
Top Forums Shell Programming and Scripting BASH: Script jams Cygwin to 100% CPU - Post 302455315 by SilversleevesX on Tuesday 21st of September 2010 09:00:20 AM
Old 09-21-2010
I was just thinking of that.

This dovetails, coincidentally, with something the author of Exiv2, Andreas Huggel, and I were discussing on his projects forum just yesterday and the day before. The "-g" option in his command-line tool, as implemented, has one shortcoming: in the case of metadata tags, keys and fields that can support multiple entries, when invoked, -g only returns the first one.

Right now, you have to use one of the modified capital P (for "Print") options, specifically -Pnv, to get the multi-line data in two columns, and then grep for the key name you want. I was thinking maybe a similar approach, one ...
Code:
fullfiledata=$(exiv2 -Pnv $line)

...with succeeding greps and cuts (or their equivalents in IFS settings and other builtins) to break down the variable fullfiledata into its component parts, which then can be further evaluated by the "if/then/fi" conditional loops, and printed to a file in the same way the current script does (unless there's a better approach to that as well).

Eight calls at once is indeed heavy loading. Especially with Cygwin, which handles that sort of thing pißß-poorly anyway, it's well-known.

This may solve another problem with the script. It hasn't been clearing those *foo2* variables consistently. Before I used the unsets, I had one line of just variable=;nextvariable=; and so forth, which did the job but (idiot me) I thought it was that which was slowing things down. Proof was in the pudding, though; a fieldsmissing.txt file I had my GNOME Terminal create had several line items with the same missing tag -- checked out in XnView, the pics were not missing the tag the list said they were. Root of that problem: a hung variable value from evaluating some earlier line item (maybe one two-dozen lines back in list.txt ).

if "one call [to Exiv2] does it all," the variable-clearing issue and the CPU load problem may both go away. I'll keep the unsets just in case. Now I think I should ask what builtins I can use to break down the "fullfiledata" variable. I've been an external 'junkie' so long in my scripting, I've yet to get my mind around them all, in a big way.

Thanks for the help so far. Hoping it continues.

BZT

Last edited by SilversleevesX; 09-21-2010 at 10:11 AM.. Reason: Completed a complex thought; style slimming, rephrasing.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to use cygwin to run bash script

Hi, all, I try to run a quite simple bash script mytest.sh in cygwin, it's content is: #!/bin/bash echo "It is my first bash shell" there are three lines in the script. The second line is blank line. When I run it use command: bash c:/mytest.sh, ... (6 Replies)
Discussion started by: Jenny.palmy
6 Replies

2. Shell Programming and Scripting

Help with bash script - Need to get CPU usage as a percentage

I'm writing a bash script to log some selections from a sensors output (core temp, mb temp, etc.) and I would also like to have the current cpu usage as a percentage. I have no idea how to go about getting it in a form that a bash script can use. For example, I would simply look in the output of... (3 Replies)
Discussion started by: graysky
3 Replies

3. Shell Programming and Scripting

Is there a way to make bash [or another shell] use all CPU cores to execute a single script?

I wrote a very simple script that matches combinations of alphabetic characters (1-5). I want to use it to test CPU speeds of different hardware/platforms. The problem is that on multi-core/processor systems, only one CPU is being utilized to execute the script. Is there a way to change that?... (16 Replies)
Discussion started by: ph0enix
16 Replies

4. UNIX for Dummies Questions & Answers

Cygwin bash script and read command

Hello everyone, I am struggling a bit with a batch script that I need to run in cygwin. I work in winXP and I had to write some awk scripts to do some file manipulation, and now I would like to automate the process by just running a batch file so that my colleagues can use it easily. Now, the... (2 Replies)
Discussion started by: Teroc
2 Replies

5. Shell Programming and Scripting

CPU assignment bash script

Hi guys, I'm basically looking for some help with a bash script I've written. It's purpose is to assign process to individual CPU cores once that process hits 15% CPU usage or more. If it drops below 15%, it's unassigned again (using taskset). My problem is that I can't think of a way to... (2 Replies)
Discussion started by: mcky
2 Replies

6. Windows & DOS: Issues & Discussions

run cygwin bash script from notepad++

I'm using Notepad++ to edit my BASH scripts and using CYGWIN to run them from Windows7. In Notepad++ there is a 'Run' capability. How do I get this to run my scripts directly without having to enter the script name from the Cygwin command line? (3 Replies)
Discussion started by: millsy5
3 Replies

7. Shell Programming and Scripting

Cygwin bash script to unmount and mount an XP partition

As stated, I am looking into keeping my backup drive unmounted in normal windows use. Partly this is to address threats like cryptolocker. Since one of my backup drives is an internal drive, it will not likely afford any protection from such a threat. I am thinking of adding code to my rsync script... (5 Replies)
Discussion started by: LMHmedchem
5 Replies

8. Shell Programming and Scripting

Bash script - cygwin (powershell?) pull from GitHub API Parse JSON

All, Have a weird issue where i need to generate a report from GitHub monthly detailing user accounts and the last time they logged in. I'm using a windows box to do this (work issued) and would like to know if anyone has any experience scripting for GitAPI using windows / cygwin / powershell?... (9 Replies)
Discussion started by: ChocoTaco
9 Replies

9. Shell Programming and Scripting

Bash Script (tar + md) on Cygwin

Hi everybody, First, I'm sorry for my bad english! I have the following situation: I have a Windows 2012 R2 with Cygwin installed. The Windows Server is used as a backup Server with Dell AppAssure installed. At the moment, AppAssure saves Backup Targets to a repository on his D. The... (9 Replies)
Discussion started by: fibra3000
9 Replies

10. UNIX for Beginners Questions & Answers

Using BATCH to call a BASH script on CygWin

I am trying to use a batch file to automatically execute a bash script with no luck this far. The batch script looks like this: C:\Cygwin64\bin\bash test.sh I have also tried this: C:\Cygwin64\bin\bash "C:\Cygwin64\bin\test.sh" Needless to say that the windows box has Cygwin... (7 Replies)
Discussion started by: Xterra
7 Replies
GREP-EXCUSES(1) 					      General Commands Manual						   GREP-EXCUSES(1)

NAME
grep-excuses - search the testing excuses files for a specific maintainer SYNOPSIS
grep-excuses [options] [maintainer|package] DESCRIPTION
grep-excuses downloads the update_excuses.html file and greps it for the specified maintainer name. The libwww-perl package is required for this script. If no name is given on the command line, first the environment variable DEBFULLNAME is used if it is defined, and failing that, the configuration variable described below is used. OPTIONS
--no-conf, --noconf Do not read any configuration files. This can only be used as the first option given on the command-line. --wipnity, -w Get information from <http://release.debian.org/migration/>. A package name must be given when using this option. --help Show a brief usage message. --version Show version and copyright information. 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 variable is: GREP_EXCUSES_MAINTAINER The default maintainer, email or package to grep for if none is specified on the command line. SEE ALSO
devscripts.conf(5). AUTHOR
Joey Hess <joeyh@debian.org>; modifications by Julian Gilbey <jdg@debian.org>. DEBIAN
Debian Utilities GREP-EXCUSES(1)
All times are GMT -4. The time now is 02:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy