Sponsored Content
Top Forums Shell Programming and Scripting Code checking for all values in the same if statement. Post 46755 by oracle8 on Friday 23rd of January 2004 08:21:42 PM
Old 01-23-2004
There are spaces before and after the ]. I am able to echo the file name as is from the first if but it should only go to the first 'if' if it satisfies the condition in it.Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

checking valid values in variable

I'm using the following in my script. if echo $cpuidle |/usr/bin/egrep ; then when I issue this statement it issues the value of the variable back to stdout which ends up in my output file. Is there a better way to write this? I'm using ksh on solaris 9. (3 Replies)
Discussion started by: MizzGail
3 Replies

2. Shell Programming and Scripting

Error code checking

I'm trying to create a directory from my Perl script. Only if the there was an error I want to let the user know about it. So if the folder exists is ok. This is what I think should work: `mkdir log 2>/dev/null`; if($? == 0 || $? == errorCodeForFileExists) { everyting is fine } else {... (3 Replies)
Discussion started by: jepombar
3 Replies

3. UNIX for Dummies Questions & Answers

checking parameter values passed to script

Hi, I will pass 3 parameters for a script.I have to check the file name and create a new file name with time stamp. the parameters which i'm passing are /dir/stg/filename.txt /dir/path/head.txt /dir/path/tail.txt Now i have to check filename like : if it is a.txt i have to create... (2 Replies)
Discussion started by: ammu
2 Replies

4. Shell Programming and Scripting

checking the return code

hi i have a file, i am reading line by line and checking a line contains a string , `grep "Change state" $LINE` if then echo "The line contains---" else echo "The line does not contains---" i need to check the return code , but i am getting an error ... (4 Replies)
Discussion started by: Satyak
4 Replies

5. Shell Programming and Scripting

Iterative statement to cut values from a line

Hi I am new to shell scripting and trying to get values from a text file, I have a text file with values seperated with "|". like aga|120220090525|120220090525|120220090525|120220090530 bab|120220090530|120220090530|120220090535|120220090535|120220090535... (4 Replies)
Discussion started by: mannepalli
4 Replies

6. Shell Programming and Scripting

SH if statement using FLOAT values

Today I spent longer than I'd like to admit figuring out how to write a Bourne shell IF statement that tests a FLOAT value before executing a block of statements. Here's the solution I found, which invokes bc. Hope this will come in handy for someone: value = testval = if then body... (5 Replies)
Discussion started by: sjepsen
5 Replies

7. Shell Programming and Scripting

Checking the Column values in a file.

Hi All, I have a file that has ~2.9Millions lines with 32 columns respectively. The columns numbers 23,27 are the primary Keys for the file. The fields are delimited by TAB. I need to check the condition If Column number: 20 is NOT NULL Column number: 21 is not 0 Column number: 22 is... (7 Replies)
Discussion started by: filter
7 Replies

8. Shell Programming and Scripting

code checking

i was just wondering how would you check , beside the lock method, if an instance of another code is already running and if it is then output a message to the user saying the program is already running and exit!! the code is in BOURNE SHELLL!!! thanks in advance!! (3 Replies)
Discussion started by: bshell_1214
3 Replies

9. Shell Programming and Scripting

Checking for duplicate code

I have a short line of code that checks very rudimentary for duplicate code: sort myfile.cpp | uniq -c | grep -v "^.*1 " | grep -v "}" It sorts the file, counts occurrences of each line, removes single occurrences and removes the ubiquitous closing brace. The language is C++, but is easily... (3 Replies)
Discussion started by: figaro
3 Replies

10. Shell Programming and Scripting

Pass values to case statement in a function korn shell

I'm in the process of writng a function that consists of a case statement is there a way of calling the function and passing a value to it? ie function1 () { case opt1 do ..... opt2 do..... esac } function opt1 I'm aware the syntax is not correct, but you get the general idea. (1 Reply)
Discussion started by: squrcles
1 Replies
PGQADM(1)																 PGQADM(1)

NAME
pgqadm - PgQ ticker and administration interface SYNOPSIS
pgqadm.py [option] config.ini command [arguments] DESCRIPTION
PgQ is Postgres based event processing system. It is part of SkyTools package that contains several useful implementations on this engine. Main function of PgQadm is to maintain and keep healthy both pgq internal tables and tables that store events. SkyTools is scripting framework for Postgres databases written in Python that provides several utilities and implements common database handling logic. Event - atomic piece of data created by Producers. In PgQ event is one record in one of tables that services that queue. Event record contains some system fields for PgQ and several data fileds filled by Producers. PgQ is neither checking nor enforcing event type. Event type is someting that consumer and produser must agree on. PgQ guarantees that each event is seen at least once but it is up to consumer to make sure that event is processed no more than once if that is needed. Batch - PgQ is designed for efficiency and high throughput so events are grouped into batches for bulk processing. Creating these batches is one of main tasks of PgQadm and there are several parameters for each queue that can be use to tune size and frequency of batches. Consumerss receive events in these batches and depending on business requirements process events separately or also in batches. Queue - Event are stored in queue tables i.e queues. Several producers can write into same queeu and several consumers can read from the queue. Events are kept in queue until all the consumers have seen them. We use table rotation to decrease hard disk io. Queue can contain any number of event types it is up to Producer and Consumer to agree on what types of events are passed and how they are encoded For example Londiste producer side can produce events for more tables tan consumer side needs so consumer subscribes only to those tables it needs and events for other tables are ignores. Producer - applicatione that pushes event into queue. Prodecer can be written in any langaage that is able to run stored procedures in Postgres. Consumer - application that reads events from queue. Consumers can be written in any language that can interact with Postgres. SkyTools package contains several useful consumers written in Python that can be used as they are or as good starting points to write more complex consumers. QUICK-START Basic PgQ setup and usage can be summarized by the following steps: 1. create the database 2. edit a PgQ ticker configuration file, say ticker.ini 3. install PgQ internal tables $ pgqadm.py ticker.ini install 4. launch the PgQ ticker on databse machine as daemon $ pgqadm.py -d ticker.ini ticker 5. create queue $ pgqadm.py ticker.ini create <queue> 6. register or run consumer to register it automatically $ pgqadm.py ticker.ini register <queue> <consumer> 7. start producing events CONFIG
[pgqadm] job_name = pgqadm_somedb db = dbname=somedb # how often to run maintenance [seconds] maint_delay = 600 # how often to check for activity [seconds] loop_delay = 0.1 logfile = ~/log/%(job_name)s.log pidfile = ~/pid/%(job_name)s.pid COMMANDS
ticker Start ticking & maintenance process. Usually run as daemon with -d option. Must be running for PgQ to be functional and for consumers to see any events. status Show overview of registered queues and consumers and queue health. This command is used when you want to know what is happening inside PgQ. install Installs PgQ schema into database from config file. create <queue> Create queue tables into pgq schema. As soon as queue is created producers can start inserting events into it. But you must be aware that if there are no consumers on the queue the events are lost until consumer is registered. drop <queue> Drop queue and all it's consumers from PgQ. Queue tables are dropped and all the contents are lost forever so use with care as with most drop commands. register <queue> <consumer> Register given consumer to listen to given queue. First batch seen by this consumer is the one completed after registration. Registration happens automatically when consumer is run first time so using this command is optional but may be needed when producers start producing events before consumer can be run. unregister <queue> <consumer> Removes consumer from given queue. Note consumer must be stopped before issuing this command otherwise it automatically registers again. config [<queue> [<variable>=<value> ... ]] Show or change queue config. There are several parameters that can be set for each queue shown here with default values: queue_ticker_max_lag (2) If no tick has happend during given number of seconds then one is generated just to keep queue lag in control. It may be increased if there is no need to deliver events fast. Not much room to decrease it :) queue_ticker_max_count (200) Threshold number of events in filling batch that triggers tick. Can be increased to encourage PgQ to create larger batches or decreased to encourage faster ticking with smaller batches. queue_ticker_idle_period (60) Number of seconds that can pass without ticking if no events are coming to queue. These empty ticks are used as keep alive signals for batch jobs and monitoring. queue_rotation_period (2 hours) Interval of time that may pass before PgQ tries to rotate tables to free up space. Not PgQ can not rotate tables if there are long transactions in database like VACUUM or pg_dump. May be decreased if low on disk space or increased to keep longer history of old events. To small values might affect performance badly because postgres tends to do seq scans on small tables. Too big values may waste disk space. Looking at queue config. $ pgqadm.py mydb.ini config testqueue queue_ticker_max_lag = 3 queue_ticker_max_count = 500 queue_ticker_idle_period = 60 queue_rotation_period = 7200 $ pgqadm.py conf/pgqadm_myprovider.ini config testqueue queue_ticker_max_lag=10 queue_ticker_max_count=300 Change queue bazqueue config to: queue_ticker_max_lag='10', queue_ticker_max_count='300' $ COMMON OPTIONS
-h, --help show help message -q, --quiet make program silent -v, --verbose make program verbose -d, --daemon go background -r, --reload reload config (send SIGHUP) -s, --stop stop program safely (send SIGINT) -k, --kill kill program immidiately (send SIGTERM) 03/13/2012 PGQADM(1)
All times are GMT -4. The time now is 11:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy