Programming :: Check The Db For Some Value And Run Some Functions To Do Some Checks?
May 15, 2011
have an application where from time to time I need to check the db for some value and run some functions to do some checks. is the best option do it as php daemon or cron job?Whatworried of cron job is the overalapping.
I have three raid volumes, md0, md1, and md2. The weekly raid-check cron always causes md0 and md2 to get checked but never md1.
Volumes md0 and md1 are on the same 8 disks. Volume md0 is a small raid1 across all 8 disks for boot and md1 is a raid5 that occupies the rest of those 8 disks. Volume md2 is a raid5 on a separate set of 6 drives. When I check /var/log/messages* I see that every Sunday md0 and md2 get checked but md1 is never checked. However, when I run 99-raid-check manually, all three volumes get checked. There is clearly something different between how crond runs that script and how I run it, but I can't imagine what that would be.
None of my daemon scripts work now, and the startup process displayed errors. Should I reinstall the OS and start from scratch, or is there a way to recover these files? Is there a way to rebuild the files I deleted?
I have problem to use an alias that defined in ksh93 script,in the functions in the same script onm Linux.I definied an alias in main: alias echo='echo -e' in order that echo will read backslashes but when i executed it in function, the alias didnt work, and performewd a regular echo, without -e
cat test.ksh #!/bin/ksh alias echo='echo -e' checkUsage
Im implementing a chat application using Jabber/XMPP and gloox framework which should send and receive messages concurrently in Ubuntu Linux.
The problem faced is both the threads are created and pthread_join( ) is called for both.The iSend thread is scheduled first but gets suspended at cin. Once the recv( ) function is called, which runs in iRecv thread, the recv call back function handleMessage( ) is called. However the control never shifts back to the iSend thread which should call SendMessage( ) function.
I am trying to write a simple program in C that involves nesting switches. For example switch 1 offers an option to go to module 1 or 2 or quit. when I go to module 1 there is another switch function offering two or more choices.
I can select either module 1 or 2 at the start of the program and the selection text for, say, module 1 prints to screen but then exits without allowing a second selection to be entered.
I tried using free([first selection]) thinking that might do the trick but it doesn't.
Is it possible to next switches on after another in C?
But I would like to avoid this approach as there are a lot of places in my program where I would have to make this change. Can I perhaps rebuild the pthreads library on macos without affecting other apps ?
I feel like there should be a cleaner way of doing this. I have one file, for example "a.cpp", calling a function from another file, "b.cpp". Currently I have it set up so that header for "b", "b.h", has the declaration of its functions. And then I'm just including "b.h" in "a.cpp". Do I have to include the "b" header file in "a" to be able to call a function from "b"? Or is there a better way I could be doing this? Like doing something different at compile?
I've encountered a problem when running a simple bit of code, I'm using c to read write data to a binary file. It works fine when I run as root. However when I run as a user it produces the file, however when I try to open / write after it's produced it caused a seg fault. Is there any reason file functions ( fopen etc ) would work for root and not a user and is there a way to fix this?
I'm trying to call some kernel functions from userspace, but I'm not sure if I'm doing it right. The functions control a pulse width modulator on an embedded platform. To pick one at random, the function:
Code: struct pwm_device *pwm_request(int pwm_id, const char *label); is defined in linux/pwm.h, and the implementation uses the macro EXPORT_SYMBOL(pwm_request), so I should be able to call this from user-space... right?
Anyway, I've got linux/pwm.h to #include in my source so the compiler knows what it's doing, but what do I link against? The only place in by kernel build tree where I can see a symbol pwm_request defined is in object files like vmlinux.o, built-in.o in the directory, etc. which I don't think I should be linking against.
My distribution is Fedora 12. When I want to get the infos of kernel functions such as printk, i type man printk, failed. I look up some articles and learn that in some distributions the kernel functions is in section 9 of man page. Then i type man 9 printk also no reply. How can i get man pages of kernel functions ?
So if you are a PHP-programmer (average one) and code for money, how many of funtions and operators of PHP should you remember by heart (in real life)? I was looking through php.net and man there are millions of tons of them!
I have created a glade file which so far have two regions in it:
1) On the right division is a toggle button which calls a C script when enabled.
2) I have a drawing area, in which I would like to plot a point (X-Y scatter plot). The plot should be generated dynamically using a C script. I am not sure how the integration between the two is possible for a drawing area.
In glade what properties of drawing area should I set? eg.expose event, realize etc. I was thinking of using cairo for generating the plot.
So I'm teaching myself some scripting to try and create a fairly simple photobooth type affair... I've got gphoto2 playing fairly nicely with my canon, and imagemagick taking that output and rearranging it to a vertical format...
EDIT: *smacks forehead*
Fairly simple to do what I needed initially: Code: feh -FZ -D 1 --cycle-once $COUNTDOWN & sleep 2 & feh -FZ -D 20 --cycle-once $SMILE This shows a countdown from 5 to 1 in images and $SMILE is big that says 'smile'
So my question is thus... (fairly basic but I can't get my head round the use of & and sleep in this context) what's the best way to call my gphoto instructions (or a script with them in) mid way through the above code?!
'feh code' sleep 5 'gphoto code'
this kind of thing seems like the way, but the'sleep 5' and 'gphoto code' doesn't start until feh is finished in this case?
I have a requirement, to read the complete proc filesystem from the linux pc.. Does linux provide some functions to read the proc filesystem means the directories and files present in the filesystem.. in short I want to create a treeview of proc filesystem. and if a user selects the file in the proc.. I should show the contents in the respective file. So I want some library or functions to read the proc filesystem..
I have this project which I've been working on essentially nonstop for the past three days and due to work I am running low on time. I'm new to Linux/Unix and my Teacher has assigned us a scripting project, due for Monday. I have All the functions for the project in a separate file which run as a daemon process when I log in. It has no syntax errors but my Script can not run the functions (I'm not sure where they go before or after the body) and I have one function I'd like you guys to take a look at. It has a Second menu leading to a case statement but it does not run after the Search. I'm Kinda tired of looking at the CLI but I have to finish this.
have an inherited base class that has some virtual members and I wish to overide these members in the derived class. So for example I have the following base class called B and the derived class called D. I will illustrate them both below. I am finding I get a linker error when making the project and cannot work out why this should be so.