i have a list of files that contains some PC hostname, then i need to enumerate every hostname and check if there's a table with same name of the hosts in MySQL database XYZ.
I need this because have to decide automatically if i have to make a create table or a insert into an existent table.
Database XYZ is composed by a table for every hostname i have (inventory purposes), now i have a scheduled task that creates a inventory text file and put it in a directory. Let's go back to first phrases of this post, i wish to feed a list of inventory files into another file then compare entries from that file with a ls (or similar) of sql directory.
I know for sure that for every old hostname there's a table named like the hostname but in the script that execute the sql code i need to create a new table in case of new hostname that make himself the inventory, so...
Eg.
I have a file named "hostnames" which contain:
And a directory "sqldir" which contains sql tables of the machines:
Now... Have anybody optimal way or suggests to read the file "hostnames" and then compare every hostname with the list of the directory "sqldir" and set a variable to make possible decide if it's the time to create a new table or append a existent one?
P.S. I have already the statement to create a new one or append, need only to put the right value for the variable which decide "right" or "left"...
Sorry if i have written too much but i'm not very confident in US/english and i fear to going misunderstood... Thx
Last edited by maxlamax; 02-15-2010 at 12:48 PM..
Reason: errors
P.S. Get in touch with shell programming i have found that is really hard and request a lot of time and practice anyway... Fortunately "exist" this forum "then" we may "find" the solutions for our problems...
I hope i have not to put this phrase in CODE wrap...
I feel stupid for asking this because it seems that MYSQL code isn't working the way that I think it should work.
Basically I wrote code like this:
select * from `Test_DC_Trailer` HAVING max(DR_RefKey);
Where the DR_RefKey is a unique numeric field that is auto iterated (like a primary key)... (7 Replies)
I have set a mysql file to excute everyday morning to generate a html file displayng 2 tables from the database. Sometime they cannot be shown, and it shows the tables are not existed. I have not drop any table, and those 2 tables are not used by any other excution. Anybody know what is happening?... (0 Replies)
i have a table
records
------------
id | user | time | event
91 admin | 12:00 | hi
92 admin | 11:00 | hi
93 admin | 12:00 | bye
94 admin | 13:00 | bye
95 root | 12:00 | hi
96 root | 12:30 | hi
97 root | 12:56 | hi
how could i only select and display only the user and event from... (6 Replies)
I need to compare the 2 mysql database tables. there are around 50 tables in each DB.
my idea is
in DB1
extract result select * from table1; to alog file1
in DB2
extract result select * from table1; to alog file2
now compare log file 1 file 2
pls help me out ...
thanks in advance (5 Replies)
Hi am creating a website for my third year at uni, am trying to create a website where the client can update the content of the site themselves, i will have a news page and i want the content to be draw from my database and displayed on the front end of the site i also want to have an admin side... (3 Replies)
(sorry for my english)
Hi, i have an app that uses MYSQL API C.. i trying do a timeout until the table is locked by an other thread , in the docs of Mysql i can see that MYSQL_OPT_READ_TIMEOUT is not implemented for linux ¿?¿?.. any body knows a way to do a timeout until the table is locked by... (0 Replies)
Hi all,
My problem: I want to connect to a remote computer (in the same office as me) which is running a mySQL server, access a specific table and update it, beofre disconnecting from the server. Is this possible? If so, any links/tutorials which might be of use?
I had thought of some sort of... (6 Replies)
Hi, iam learning MySql. Iam trieing to create a table in the database "guestbook"
at the command line in mysql heres what i type but i get a error
mysql>create table guestbook
->(
-> name varchar(40) null.
-> url varchar(40) null.
-> comments ... (3 Replies)