03-20-2017
You probably need to specify a complete file:
-o /path/to/textfile.txt
cron runs as root, then su to the owner of the crontab file. It DOES NOT execute any of the login scripts. So there is a chance that the script is running in some other current directory.
This User Gave Thanks to jim mcnamara For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I new to Unix and scripting. Following is my requirement. Can someone tell me whether its possible or not. Also please let me know how to proceed further if this is possible.
List of queries are stored in a file. For example, I have to run a query like this:
Select * from &XYZ where... (0 Replies)
Discussion started by: simhasuri
0 Replies
2. Shell Programming and Scripting
Hi guys,
i know how to run a single query using mysql embedded in a shell script as follows:
`mysql -umyuser -pmypass --host myhost database<<SQL
${query};
quit
SQL`
However, how would i be able to run several queries within the same connection?
The reason for this is i am creating... (3 Replies)
Discussion started by: muay_tb
3 Replies
3. Shell Programming and Scripting
Hi folks,
I've been using grep -f file1 file2 to get lines that match a file1 line from file2. I'm now interested in getting the lines from file1 where there was no match in file2.
I believe the -v option will give me unmatched lines from file2, but I'm looking for unmatched lines from... (3 Replies)
Discussion started by: sanjuro
3 Replies
4. Shell Programming and Scripting
Hi Everyone,
When i finish running
# echo `psql -t -U root databaseA -c "select a, b from book"`;
i get the output
107275 | 14 107301 | 2 107446 | 6 107820 | 77 107929 | 101
Would like to have the result like:
107275 | 14
107301 | 2
107446 | 6
107820 | 77
107929 | 101 (7 Replies)
Discussion started by: jimmy_y
7 Replies
5. UNIX for Advanced & Expert Users
Hello everyone,
It's my first week using unix and shell scripting. I tried creating a script that has a function that execute SQL query. my script looks something like this:
----------------------------------------------------
#!/bin/sh
tableName="myTable"
secondTable="secondTable"... (2 Replies)
Discussion started by: edlin_r
2 Replies
6. UNIX for Dummies Questions & Answers
I need to connect a databas eusing sqlplus and i need to store the results of each query in separate file.
is it possible to achieve this usng single sqlplus?
i dont want to connect each time for each query.
thanks (3 Replies)
Discussion started by: pandeesh
3 Replies
7. Shell Programming and Scripting
Hi,
I want to grep multiple patterns from multiple files and save to multiple outputs. As of now its outputting all to the same file when I use this command.
Input : 108 files to check for 390 patterns to check for. output I need to 108 files with the searched patterns.
Xargs -I {} grep... (3 Replies)
Discussion started by: Diya123
3 Replies
8. Shell Programming and Scripting
Hi All,
I have a file queries.txt as follows :
SELECT COLUMN1 FROM SCHEMA2.TABLE1 MINUS SELECT COLUMN1 FROM SCDEMA2.TABLE2;
SELECT COLUMN2 FROM SCHEMA2.TABLE1 MINUS SELECT COLUMN2 FROM SCDEMA2.TABLE2;
SELECT COLUMN3 FROM SCHEMA2.TABLE1 MINUS SELECT COLUMN3 FROM SCDEMA2.TABLE2;
SELECT... (2 Replies)
Discussion started by: SriRamKrish
2 Replies
9. Shell Programming and Scripting
Hello
Just edited the entry to make it easier to understand what i want
How can i achieve this: GOAL:
read 2 field from a table with PSQL
result of this PSQL command is this
INSTALLEDLANG=$(su - postgres -c "psql -A -t -q -c -d ${DBNAME} -t -c 'SELECT code, iso_code from res_lang'")
... (0 Replies)
Discussion started by: winston6071
0 Replies
10. Shell Programming and Scripting
Hi All,
I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise.
Eg :
Select 'Query 1 output' from dual;
Select 'Query 2 output' from dual;
I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies
LEARN ABOUT PHP
pg_send_query
PG_SEND_QUERY(3) PG_SEND_QUERY(3)
pg_send_query - Sends asynchronous query
SYNOPSIS
bool pg_send_query (resource $connection, string $query)
DESCRIPTION
pg_send_query(3) sends a query or queries asynchronously to the $connection. Unlike pg_query(3), it can send multiple queries at once to
PostgreSQL and get the results one by one using pg_get_result(3).
Script execution is not blocked while the queries are executing. Use pg_connection_busy(3) to check if the connection is busy (i.e. the
query is executing). Queries may be cancelled using pg_cancel_query(3).
Although the user can send multiple queries at once, multiple queries cannot be sent over a busy connection. If a query is sent while the
connection is busy, it waits until the last query is finished and discards all its results.
PARAMETERS
o $connection
- PostgreSQL database connection resource.
o $query
- The SQL statement or statements to be executed. Data inside the query should be properly escaped.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
Use pg_get_result(3) to determine the query result.
EXAMPLES
Example #1
pg_send_query(3) example
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
if (!pg_connection_busy($dbconn)) {
pg_send_query($dbconn, "select * from authors; select count(*) from authors;");
}
$res1 = pg_get_result($dbconn);
echo "First call to pg_get_result(): $res1
";
$rows1 = pg_num_rows($res1);
echo "$res1 has $rows1 records
";
$res2 = pg_get_result($dbconn);
echo "Second call to pg_get_result(): $res2
";
$rows2 = pg_num_rows($res2);
echo "$res2 has $rows2 records
";
?>
The above example will output:
First call to pg_get_result(): Resource id #3
Resource id #3 has 3 records
Second call to pg_get_result(): Resource id #4
Resource id #4 has 1 records
SEE ALSO
pg_query(3), pg_cancel_query(3), pg_get_result(3), pg_connection_busy(3).
PHP Documentation Group PG_SEND_QUERY(3)