01-07-2009
multiple processes overlap
Hello
I've got a script that creates multiple processes, in ksh, to bcp out 6 tables at a time. In the script, we write messages to the log to show our progress; most of the time, the log messages are nice and neat with one per line, like they should be. But every once in awhile, at random, the messages will "overlap" each other, and I can't see why. I tried putting a sleep 1 just before we write to the log file, but the log messages still overlap.
Here is a small portion of the log file:
________________________________________________
01/07 13:37 CER_PZME_MENU_ENT..chgenv01 - bcp out started
01/07 13:37 CER_PZMG_MENU_GRP..chgenv01 - bcp out finished successfully
01/07 13:37 CER_PZCI_C0L1I/E0N7T 1_3U:.3.7c ChEgRe_nPvZ0A1P -_ bAcPpP o.u.tc fhigneinsvh0e1d - s buccpc oeusts ffiunlilsyhed successf
ully
01/07 13:37 CER_PZME_MENU_ENT..chgenv01 - bcp out finished successfully
01/07 13:37 CER_PZCO_VALRLSE..chgenv01 - bcp out finished successfully
...
...
01/07 13:39 NWX_NSCT_SCHD_TYPE..chgenv01 - bcp out finished successfully
01/07 13:39 NWX_NSCV_SCH_VALUE..chgenv01 - bcp out fini0s1h/e0d7 s 1u3c:c3e9s NsWfXu_lNlSyHC_SCHEDUL
ES..chgenv01 - bcp out finished successfully
____________________________________________________
and here is a little bit of the code that we use. The echo statement at the bottom is what is being written to the log; I can't see why this "overlap" problem is random, and doesn't effect all the messages.
_____________________________________________________
bcp_with_error_check $dbname..$stbl out $sfile_main -$mode -b10000 -A8192 -e$sfile_error -U$suser -S$senvname -P$spass > /dev/null
# Write to the log the table date/time -- completed
sleep 1
echo `date +"%m/%d %H:%M"` $strTableName..$dbname - bcp out finished successfully
_____________________________________________________
Any help would be appreciated. tia
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Suppose that I am performing some operation on an sql database. Lets say process of Searching and then if a value is found, updating it... Now, when I have some millions of records on which the operation has to be performed... Does it help to spawn multiple processes each executing the same... (9 Replies)
Discussion started by: Legend986
9 Replies
2. UNIX for Advanced & Expert Users
Hi - I need help. My user crontab is spawning multiple at processes (and multiple mencoder program starts, that exit, then restart, repeatedly), locking up my system.
For example I have this entry in my crontab:
$ sudo crontab -u victoria -e
* * * * * ~/recordings/pvr1
* * * * *... (10 Replies)
Discussion started by: gstuart
10 Replies
3. UNIX for Dummies Questions & Answers
Hi guys,
I want to run the multiple scripts at the same time using a ksh script.
For example, I have three scripts to run:
a.ksh, b.ksh and c.ksh
How to start the above 3 scripts simultaneously and then on the completion of the above scripts I have other tasks to schedule.
Thanks
Gary (6 Replies)
Discussion started by: abcabc1103
6 Replies
4. Programming
I'm trying to make a program that will spawn multiple child processes then exit. I'm having trouble figuring out how to do this since after I fork, the child process begins running the program again (never ending).
int main(void){
for(int i = 0; i < 3; i++){
fork();
}... (1 Reply)
Discussion started by: cagney58
1 Replies
5. Programming
I am having problems creating multiple forks. I want create a certain number of forks, each call a program and each wait for a different value. How is this accomplished my loop is not doing the trick.
for (i = 0; i < 5; i++) {
if (fork() < 0) {
//print error
}
... (3 Replies)
Discussion started by: Vikings1201
3 Replies
6. Programming
I have a number of binaries which I currenlty have no control over. They alright data to stdout. I would like to kick off any number of these binaries and capture and process their stdout. Doing this for one process is straight forward for example - comments and error checking removed for... (6 Replies)
Discussion started by: dvales
6 Replies
7. Shell Programming and Scripting
Want to kill multiple processes by name. for the example below, I want to kill all 'proxy-stagerd_copy' processes.
I tried this but didn't work:
>> ps -ef|grep proxy_copy
root 991 986 0 14:45:34 ? 0:04 proxy-stagerd
root 1003 991 0 14:45:49 ? 0:01... (2 Replies)
Discussion started by: catalinawinemxr
2 Replies
8. Solaris
Hello people,
I got one problem with a script.
I have a script which runs every five mins and in the script an ftp process is invoked which sends files to a particular location.
The problem is that the ftp process hangs every now and then which causes the whole script to hang.
As the... (4 Replies)
Discussion started by: m_usmanayub
4 Replies
9. Shell Programming and Scripting
:)Hi there, I am new to scripting and wanted to see if someone can show me how to grep on multiple processes and send the output to a file in /home/mydir/output.
I am aware of
ps -ef | grep on 1 process
but need help looking up multiple processes, can you use this command
ps -elf | grep |pid1... (4 Replies)
Discussion started by: abbya
4 Replies
10. Shell Programming and Scripting
Hi,
I have three files in my IN directory.Each file should be copied 25 times using for loop.Each file processing should run in parallel?How to spawn multiple processes in unix?Any help would be appreciated.
Thanks,
Liyakath (7 Replies)
Discussion started by: liyakathali
7 Replies
LEARN ABOUT DEBIAN
freebcp
freebcp(1) FreeTDS Utilities freebcp(1)
NAME
freebcp - bulk loading utility for Sybase and Microsoft databases
SYNOPSIS
freebcp [[database.]owner.]object_name {in | [query]out} datafile
{ -c | -n | -f formatfile }
[-b batchsize] [-F firstrow] [-L lastrow] [-e errfile]
[-I interfaces] [-m maxerrors] [-t field_term] [-r row_term]
[-h hints] [-T textsize] [-A packet_size] [-O options]
[-S servername] [-U username] [-P password] [-EdVv]
DESCRIPTION
freebcp is a utility program distributed with FreeTDS. freebcp replicates (in part at least) the functionality of the "bcp" utility pro-
grams distributed by Sybase and Microsoft.
freebcp makes use of the db-lib bcp API provided by FreeTDS. This API is also available to application developers.
The manual pages or online help for Sybase or SQL Server can be referenced for more detailed information on "bcp" functionality.
TABLES AND FILES
database
The database of the object being copied. Optional if the table/view is in the default database for username.
owner The owner of the object being copied. Optional if username or the database owner is the owner of the table.
object_name
Usually, object_name is the name of the database table you wish to access. It can also be a view (and, subject to constraints, it is
sometimes possible to load a view). It can also be an SQL query, cf. queryout, below.
in | [query]out
The direction of the bulk copy operation. 'in' indicates data are to be copied from a host file into a database table; 'out' indi-
cates data are to be copied from a database table to a host file. 'queryout' indicates that table_name is in fact a query, rather
than a database object. freebcp will execute the query and write the results to a file. (It is a good idea to have the query return
one and only one result set.)
datafile
The name of an operating system file.
OPTIONS
-c The host data file is (or will be) in "character" format, i.e., a text file. Encoding is determined by the client charset attribute
in freetds.conf.
-n The host data file is in "native" format. This is a format that freebcp will be able to process, but is not portable or readable.
-f formatfile
The format of the host data file is described by formatfile. The layout of formatfile is identical to that understood by the Sybase
and Microsoft bcp utilities, but is too complicated to describe here.
-b batchsize
The number of rows per batch of data copied. Batching applies only when you are bulk copying into the database. Each batch of data
is effectively 'committed' into the database. The default value for batchsize is 1000.
-F firstrow
The first row to copy from the input file or database table. The default is the first row, row 1.
-L lastrow
The last row to copy from an input file or database table. The default is the last row.
-r row_term
The row terminator for a character file. May be more than one character. Default is newline ('
'). Cf. -c, above.
-t field_term
The field terminator for character file. Also known as a column delimiter. May be more than one character. Default is tab (' ').
Cf. -c, above.
-m maxerrors
Stop after encountering maxerror errors. Default 10.
-e errfile
Write errors to error_file. For uploads. Includes line and column information, and the row data.
-S servername
The name of the Database Server to which to connect.
-U username
A database login name. If username is not provided, a domain login is attempted for TDS 7+ connections.
-P password
A database password.
-E Write the data in datafile to the table's IDENTITY column. Without this flag, the identity data present in the datafile will be
ignored, and new IDENTITY values will be generated for the imported rows.
-d Turn off any logging. (Unintuitive, perhaps.)
-O options
SQL text to set connection options prior to the bcp operation. If options is a valid filename, the SQL is read from the file
instead. Sometimes needed for queryout. Example: "-O 'SET QUOTED_IDENTIFIER ON'"
-I interfaces
The name and location of the interfaces file to search when connecting to servername. Overrides freetds.conf.
-h hints
Set bcp hints. For valid values, cf. bcp_options() in the FreeTDS Reference Manual.
-T textsize
For text or image columns, set the maximum number of characters to request from the server. Defaults to the setting in freetds.conf.
If not specified anywhere, defaults to the full size of the data.
-A packet_size
Set the size of a TDS packet to packet_size. Not sure why you would want to do this, except as an experiment.
-v -V Print the version information and exit.
ENVIRONMENT
DSQUERY
default servername
NOTES
When connecting to a Sybase database server, it is required that the TDS 5.0 protocol be used. When connecting to a Microsoft SQL Server
2000 database server, the TDS 7.1 protocol is required.
Theoretically both Sybase and Microsoft support the TDS 4.2 protocol, but in reality they implement the bcp portion of TDS 4.2 differently.
FreeTDS has no way of knowing which type of server it's connected to, hence TDS protocol 4.2 is not supported.
HISTORY
freebcp first appeared in FreeTDS 0.60
AUTHORS
The freebcp utility was written by Bill Thompson (thompbil@exchange.uk.ml.com)
BUGS
Currently, there is no support for text data types in freebcp, when SQL Server 2000 is the target database.
doc 13 November 2011 freebcp(1)