#!/usr/bin/perl use DBI; my ($db, $user, $pw) = ('dbname', '****', '***********'); my $dbh = DBI->connect("DBI:mysql:$db",$user,$pw) or die "Cannot connect to $db: $DBI::errstr
[code].....
The error message is
[Wed Feb 24 13:03:27 2010] myscript.cgi: DBD::mysql::st execute failed: Column count doesn't match value count at row 1 at myscript.cgi. [Wed Feb 24 13:03:27 2010] myscript.cgi: DBI::db=HASH(0x8a30c60)->errstr
I am trying to get the count of number of CD-ROMs attached with my Linux system using a bash shell script. I have decided to use the following method for it:
upgrading my notebook from Slackware 13.0 to 13.1. There are always some tricky things to wrap around when such upgrade times come, but now I think I caught a bug in mkinitrd, if I'm not wrong. mkinitd doesn't return when I run:
[code]...
After some debugging, I found that the routine copy-libs() is stuck in an infinite loop, because the statement "while [ "$COUNT" != "0" ]; do" does hold always (that is, COUNT never reaches zero). This, by its side, happens because the set of libs whose dependencies should be checked against are regenerated integrally after each step, and the algorithm doesn't converge. I could fix the problem adding some code, which removes the libraries found in the iteration "i-1" from the list of files found in the iteration "i". A patch in provided below. This done, I could build my first initrd image for Slack 13.1 and put it to run with kernel 2.6.33.4.
I need to count files in a dir which were updated yesterday.
ls -lth | grep -i 'Jul 7' | wc -l
The dir holds files of last 15 days and total count is as 2067476. Is it efficient to count the files using perl? I have developed the following perl script making use of system().
This is my first linux related question so be kind!
One thing I find is my digital cardreader doesn't work well on Linux. I've wrote some code to fix this but when I try to click on visual studio nothing happens it won't install.
I have log files that should be parsed and then deleted by a script on a regular basis. Sometimes things don't work for a variety of reasons and the log files sit and sit and are never dealt with. What I need is a small script that can give me the files older than X days and a count of those files.
What I have so far helps me take care of things manually but I need a little automation in my life Here is what I have: I can count all the files in the necessary directories recursively with this: ls -laR | wc -l And I can find all the files that are older than 10 days that haven't been deleted yet by doing this: find /home/mike/logs -type f -mtime +10 But how do I put both of them into a script that will just give me the end number of both?
I have written a code on Linux that searches a long dictionary. I have used hsearch() function but the problem is it does not work. This is my code://Search the count values from the dictionary.
I open each DIC file, get the word from it and search the hash table and extract the key from it. The problem with the above code is that it is able to make the hash table but it returns NULL when searching. It should not return NULL in any case because all words from DIC files are there in the dictionary. I am not able to figure out why?
And I'm trying to count the number of slashes in each line. I figured (with my limited knowledge of bash) that the best thing to use would be sed. So I ran this to print "not /": sed '!s////g' file # and eventually adding " | wc -m" to it. and I got the same result as if I ran cat, no modification at all:
The clock applet "Clock 2.30.0" in my panel reads correctly on boot, and then never updates itself. When I go to its preferences, time setting is correct and continuously updating, but the display in my panel never changes. I can use "killall-gnomepanel" from terminal, and this rests everything, making the time display correctly. Furthermore, it updates itself afterward... but I'd like the dang thing to function correctly without resorting to that.
Unfortunately, the second grep is greedy swallowing everything up to the last </ul> close tag. (The desired result is 2.) Speed is an issue as I will be searching through 350,000 files.
I am trying to count no. of characters in a word but it is coming one more than what it actually should be.
Code:
I can have a work around by subtracting 1 from the output (6-1=5 in this case). BUT, I am just curious to know, why the character count is coming as 6 and not 5.
What I want to do is from a file having block like
<event> 8 3 0.2685416E-02 2 -1 0 21 -1 0
[code]...
The first line after the "<event>" is its process-id, so I would like to have at the end a summary of how many "event" block I have for each type, ie how many
6 1 0.2685416E-02
or how many
7 2 0.2685416E-02
etc etc
I do not know in advance how many different-kind of block I will have, so it has to be a bit smart to scan the file, and make an new "summary" info for each unique type I was using something like
I need something to make a script that will search some logs and extract IP hits from one country only. Let's say UK. I guess I need to use GeoIP or some database. I just need a very simple bash, perl, php script that will do this job. Just search threw logs (apache) and then give me number of hits found from UK.
I'm the POC for all my families Linux computers. Is it possible to get statistics on which programs are accessed, how frequently, for how long and by which user?
When it comes time to upgrade it would be useful so I know which programs to concentrate my testing. I usually just e-mail and ask but every time people forget to send me the programs they actually use.
I have upgraded to ubuntu 11.04 yesterday, but i found that there isn't any clock show on the top right side of the unity panel. I would like it to appear on the panel. How can i fix that?
I'm working on a bash script that will go through a directory, find the sub-directories that have been created since the last time the script ran, count the results, and output that integer (will most likely be '1' or less per each instance run) to a file. Give the circumstances, my previous (and very limited) experience with bash is not sufficient for me to pull this off. since it probably has bearing, is that my mail server stores files that it flags as viruses in a folder. It creates a sub-directory for each virus that it quarantines .I want to count those subdirectories and graph them with MRTG. Hence the script. I'm going to post what I've got so far and the purpose of it, because I'm told I have a very odd and efficient way of doing scripting.
[Code]...
But then it dawned on me that it wouldn't work because I would have to not count the directories that have already been counted and count the ones that have not been counted. Given that the purpose of this is to generate a graph about every 5 minutes, using find won't work because, to my knowledge, that will only find things based on whole day values, I need it almost down to the minute.
I am new to perl scripting and wrote a perl script to read the directories and files and count the no of files in each directory and generate a log file. The problem is it is not printing anything to the log file. I am copying the script below.
I'm using MYTHTV with AT&T's U-Verse system. AT&T apparently turns off the set-top box if the box doesn't receive any commands after some number of hours. When this happens the box takes so long to turn on that it doesn't process the lirc IR channel change command. I've rewritten my channel changer to add a lockfile, and added a cron entry to kick off an entry to just "ping" the set-top box once an hour. But, OK, I'd like to play the bandwidth saving game and not do this if there isn't anything in the "record" table.
So, how would I write a script that will check the number of rows in the "record" table in the "mythconverg" database and exit if there are zero rows? I'm afraid I don't know how to even start this. Here is my "keepalive.sh" script that does the pinging:
Code: #!/bin/sh #if there are no rows in the record table, just exit this script # lock the lockfile - MUST be same one as channel lock while [ `lockfile "/tmp/mythchanlock.lck"` ]
I would like to parse an input file in which there are two columns per each row. We want to see how many lines are duplicated where we define duplicate to be having the same second field and different first field. For instance if the input file looks like the following:
While dual-booting Windows and Linux, Linux sets the system time to UTC, so Windows thinks it's midnight near mid-morning. Is there any other way to tell Windows to use UTC? I've seen the registry tweak proposed here and other places. This does not work on my computer (Windows 7 32-bit).For reference, the registry entry is this:HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTimeZoneInformation]"RealTimeIsUniversal"=dword:00000001
I triple boot with XP on the first partition, sidux on the second and third and Ubuntu on the fourth. sidux controls grub2. When I boot into XP or Ubuntu, my clock gets set ahead 4 hours to UTC time (I'm on Eastern daylight time).
Is there a way for all three OSs to display the right time?