linux

Auto-Backup script for mysql in Unix

I'm a Windows user but I've been asked to write a script that runs on Linux that does automatic backup for the MySQL database. I know how to do the backup (using mysqldump) but I don't know how to write a script in Linux and how to schedule it to run daily. How can it be done ? ...

unistd.h and c99 on Linux

This simple .c file: #include <unistd.h> void test() { char string[40]; gethostname(string,40); } ... when compiled normally, works fine: $ cc -Wall -c -o tmp.o tmp.c $ ... but when compiled in C99 mode, gives a warning: $ cc -Wall -std=c99 -c -o tmp.o tmp.c tmp.c: In function `test': tmp.c:5: warning: implicit declaratio...

Linux Shell scripting to compare the source folder and tar file

Hello Everybody, I need a shell script in linux to compare the source folder with the tar file. If a file is missed or excluded during tar, should reflect while execute this script. I have tried the option tar dvf to compare, it did not worked out, because it is comparing with tar file to source file. I need source file comparison with ...

Shellcode and format string vulnerabilities?

Hi, Here at my job, we have a lot of machines running RH 9, RH Enterprise 3 and some older Linux tastes. As I read about the "format string vulnerability" and "shellcode", I would like to know how to see if that Linux are vulnerable to these kinds of attack (without running the attacks itself)... Thanks for help! ...

Linux File Logs

I need to view a log of files that have been opened, surely there are logs stored for this, but I have not been able to find them in the /var/log/ directory. Thanks, Dave ...

Is it safe to recompile an executable while it's running?

What happens if I recompile an executable while it's running? Does the operating system read all of the executable's contents into memory when it starts running it, so it will never read the new executable file? Or will it read sections of the new executable file thinking it hasn't changed, leading to possibly undefined behaviour? What ...

Testing a Linux daemon on an embedded system

I have written a daemon in linux for doing dhcp for an embedded system. This platform only has a linux kernel running on it and have no CLI support. What is the best way for me to test my daemon? How do I write a program that will call the main function in this daemon and verify if its working fine? Appreciate the answers. ...

Programmatically run at startup on Linux?

How do I programmatically set an executable on Linux to run when the user logs in? Basically, the equivalent of the HKCU\Software\Microsoft\Windows\CurrentVersion\Run registry key in Windows. ...

Generating a sha256 from the Linux command line

I know the string "foobar" generates the SHA 256 hash c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 using http://hash.online-convert.com/sha256-generator However the command line shell: hendry@x201 ~$ echo foobar | sha256sum aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f - Generates a different ...

What's actually in the Managed Runtime Initiative's kernel patches and JVM?

http://managedruntime.org/ is pretty sparse on what exactly are in the tarballs and why users would want them. http://lwn.net/Articles/392307/ has some more details, but the author also isn't sure what the memory management modules actually do. Apparently the high-level goal is to reduce GC pauses, but I'd be interested in (pointers to) ...

dlopen with two shared libraries, exporting symbols

I have a linux shared library, foo.so, which is loaded from an executable using dlopen("foo.so", RTLD_NOW | RTLD_LOCAL). From foo.so I'd like to dlopen another library, bar.so, which references symbols defined in foo.so, but the linker fails to find them. I can't change RTLD_LOCAL to RTLD_GLOBAL, because I don't have the source to the ex...

C APIs for fetching Memory and File Handle count

Are there any C APIs for fetching free memory, swap memory consumption and to fetch file handle count similar to statvfs for file system information instead of directly parsing the /proc file system? ...

Detecting Cache Misses and Hits Pragmatically in Linux

I know this is platform-specific question, however, I would like to do some run-time analysis of an application to detect cache misses and hits. I know cachegrind, a tool for valgrind, and of vtune, and that a slew of other profiling utilities exist. However, I am interested, in implementing my own version of cache-miss detection. I k...

Programming language and O/S for a kiosk based system

I am going to be developing some software for a kiosk and was wondering what operating system and programming language I would be best off going with. I understand kiosks a bit and realized there are lot of issues as it pertains to software upgrades, etc so I want an environment that can be easily managed remotely but is also secure. ...

using libnet to send ARP request, but arp cache won't update after getting the ARP reply

Hi, I need to look up MAC address in the local network and I'm using Linux. What I do is send a ARP request with libnet, but after I send 3 requests, the cache still won't update. I use wireshark to catch the packets. From wireshark, I did get 3 ARP replays, after each of my ARP request. Does anyone know how come the ARP cache won't ...

Why ulimit can't limit resident memory successfully and how ?

I start a new bash shell, and execute: ulimit -m 102400 ulimit -a " core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 20 file size (blocks, -f) unlimited pending signals (-i) 16382 max locked memory (kbytes, -l) 64 max memory siz...

Accessing linux file system in a C# program.

Hi all, I am programming a C# application that checks the last time a file was modified on 3 different servers, one of these being linux. Being a different file system what are the possible ways to check when said file was last modified on the system. I have full access to modifying the server to an extent but I am looking for a number...

Linux and C : How to do a cleanup after SIGKILL ?

Hi. I'm working on a program which uses shared memory. Multiple instances of said program will either connect to an existing one or create it anew, and give it back to OS when there are no other processes or just detach it and terminate. I thought of using a simple counter to keep track of how many processes use it. I'm using atexit() ...

color the lines of logcat on Linux [android]

The Logcat in Eclipse has colors ofr errors, warning, debug, ... How can I do to get the same result on Linux (Ubuntu) when I run the command 'adb -e logcat' in a terminal to get it colored? ...

Variable stack size

My system (linux kernel 2.6.32-24) is implementing a feature named Address Space Layout Randomization (ASLR). ASLR seems to change the stack size: void f(int n) { printf(" %d ", n); f(n + 1); } int main(...) { f(0); } Obviously if you execute the program you'll get a stack overflow. The problem is that segmentation fault...