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 make the script check if the process is already assigned to an invidividual core, and if so to make it skip the assigning process and remove that core from the array of available cores (there is only enough cores in the array to allow each core to have two processes assigned each [there won't be more than that many processes on the machine so it won't ever go over the limit]). As it currently works, a process might be over 15% and already assigned to one CPU, but if another process' status has changed it could be moved from one CPU to another. I'd like this not to happen, so it doesn't switch processes between CPUs all the time.
Keep in mind I'm pretty basic in my knowledge of this stuff so some parts of the script might be a bit iffy as well. Any suggestions to fix other parts would be appreciated too.
This is what I have so far (for a quad core [you can see it's only for processes with ds_i in them]):
I need a script that will check if what I input is a file or not.
Also a short script that copies a file that I tell it to, to a directory I tell it to.
Thanks. Those are the only 2 I need, I got the other 8 done. (1 Reply)
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)
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)
I'd like to streamline the code more than a bit to get it to run faster.
There's a thread about this and related issues of mine on the Cygwin mailing-list, but I want to eliminate any chances it might just be inefficient/inelegant/crappy code. A previous run of the same script on both Cygwin and... (6 Replies)
Please take a look I am stuck on step 4
1. The problem statement, all variables and given/known data:
#!/bin/bash
### ULI101 - ASSIGNMENT #2 (PART A) - DUE DATE Wed, Aug 3, 2011, before 12 midnight.
###====================================================================================
###... (13 Replies)
Here's the assignment. I'll bold the parts that are rough for me. Unfortunately, that's quite a bit lol. The syntax is, of course, where my issues lie, for the most part. I don't have a lot of programming experience at all :/. I'd post what I've already done, but I'm so lost I really don't know... (1 Reply)
Suppose I have a file named Stuff in the same directory as my script. Does the following assign the file Stuff to a variable?
Var="Stuff"
Why doesn't this just assign the string Stuff? Or rather how would I assign the string Stuff to a variable in this situation?
Also, what exactly is... (3 Replies)
I have come across a weird behaviour in bash and would love to get to the bottom of it. If I execute echo -e "\na\nb\nc\n" at the command line, I get:
a
b
c
However, if I wrap it in an assignment such as:
A="$( echo -e "\na\nb\nc\n" )"then I get
a
b
cIt doesn't show very well,... (4 Replies)
I have a little code block (executing on AIX 7.1) that I cannot understand why the NOTFREE=0 does not appear to be assigned even though it goes through that block. This causes a unary operator issue.
#!/bin/bash
PLATFORM="AIX"
NEEDSPC=3000
set -x
if ; then
lsvg | grep -v rootvg | while... (6 Replies)
Discussion started by: port43
6 Replies
LEARN ABOUT DEBIAN
pct-scanner-script
PCT-SCANNER-SCRIPT(1) General Commands Manual PCT-SCANNER-SCRIPT(1)NAME
pct-scanner-script - easy scan and create merged DjVu and PDF documents for archiving
SYNOPSIS
pct-scanner-script [--help]
DESCRIPTION
pct-scanner-script is a bash script and configuration system to easily scan documents and create a digital archiving. It can create DjVu
PDF and JPEG outputs, in merged and individual files. It also has a configuration system where different configurations can be defined,
making it easy to switch between configurations.
Please use pct-scanner-script --help to find all program options, the complete help, and all examples.
Features:
- auto archiving in merged and individual DjVu, PDF, and JPEG files
- auto and manual resume when scanning somehow fails
- cascading configuration system, for easy customizing
- easy command-line-style bash program, with useful options
- archiving made possible with both adf and flatbed scanners
- built for productivity and daily use
- uses bash, scanadf and other mainstream processing tools
- multilanguage commandline output
OPTIONS -h, --help, -?
Show summary of options, help, and examples.
DEBUGGING
This program is a helper script to easy scan and automated digital document archiving for normal and adf scanners. You can debug this
script by running it as bash -x pct-scanner-script [options]. The script is just a nice wrapper for the scanadf, DjVu and PDF tools.
SEE ALSO scanadf(1),
AUTHOR
pct-scanner-script and this manual page are written by:
Jelle de Jong <jelledejong@powercraft.nl>.
March 31, 2009 PCT-SCANNER-SCRIPT(1)