linux

How do I install Pdftk on my server?

I am using a Linux Server and am trying to install Pdftk, but I am problems trying to figure out what exactly to do. I found the following documentation on how to install it, but they refer mostly to installing it on the local Windows machine. They are: http://www.andrewheiss.com/blog/2009/07/29/installing-pdftk-php/ http://www.access...

Is reading a double an atomic operation in linux?

I'm creating a simple server which stores several variables globally. On occasion these variables will update and during this time the variables are locked from other threads. Each client who accesses the server is granted their own thread, but has no way to change these variables and are essentially readonly. My question to the internet...

Explicitly invoke SIG_DFL/SIG_IGN handlers on Linux

I've blocked, and then waited for a signal via the following code: sigset_t set; sigfillset(&set); // all signals sigprocmask(SIG_SETMASK, &set, NULL); // block all signals siginfo_t info; int signum = sigwaitinfo(&set, &info); // wait for next signal struct sigaction act; sigaction(signum, NULL, &act); // get the current handler for th...

Starting with a simple unit test in c

Hi, I was told by my boss to write unit tests for the little c file (foo.c) I wrote. I read a lot about the background of unit testing online, like testing only one function and making tests fully automated, but I did not find any tutorial about how to implement an actual unit test. I tried the following approach, but failed. /*f...

Linux: can I read the output of another process without using any IPC (pipes, etc.)?

Is it possible in linux to somehow read the output (from stdout and stderr) of another process without it knowing about it? So lets say I have a process A running in the background and process B wants to read its output - is it possible? I can't use pipes or the screen program. I tried reading from /proc/xxx/fd or from /pts/x consoles an...

What is the diffrence between Trap and Interrupt ?

What is the diffrence between Trap and Interrupt ? This is a question from an Exam so i need the basic diffrence/s ...

Architectural tips on building a shared resource for different processess

Hi all, In the company I work at we're dealing with a huge problem: we have a system that consists in several units of processing. We made it this way so each module has specific functionality. The integration between these modules is done using a queue system (which is not fast but we're working on it) and replicating messages between ...

Running shell script from PHP as different (non root) user

I'm trying to run a shell script owned by a non-privileged user from PHP on an Ubuntu server. Issues with permissions make running it with exec() impractical, as it's www-data that's running it. I've googled a bit and found varius references to suExec (which seems too much of a hassle to get working for such a small problem), setting the...

Is it possible to use 9-bit serial communication in Linux?

RS-232 communication sometimes uses 9-bit bytes. This can be used to communicate with multiple microcontrollers on a bus where 8 bits are data and the extra bit indicates an address byte (rather than data). Inactive controllers only generate an interrupt for address bytes. Can a Linux program send and receive 9-bit bytes over a serial d...

JMeter - Loopback address error when launching jmeter-server on Linux.

Hey all, I'm trying to set up a distributed load testing environment using JMeter. I need to set up the remote clients using something portable like a Linux Live CD, but whenever I attempt to launch jmeter-server in Linux, I receive the following error... Created remote object: UnicastServerRef [liveRef: [endpoint:[127.0.0.1:49018](lo...

What IDE you using

Possible Duplicate: Any good PHP IDE, preferably free or cheap? Recently i change my windows to gentoo-linux. And don't know wich IDE change for web-dev. In windows i use PHPDesigner. Need autocomplete, projects and etc. ...

Run command from variables in shell script

I wrote this piece of code to scan a directory for files newer than a reference file while excluding specific subdirectories. #!/bin/bash dateMarker="date.marker" fileDate=$(date +%Y%m%d) excludedDirs=('./foo/bar' './foo/baz' './bar/baz') excludedDirsNum=${#excludedDirs[@]} for (( i=0; i < $excludedDirsNum; i++)); do myExcludes=${...

postfix problem sending email "RCPT reject localhost not listed"

i am hacing a hard time getting postfix to send emails. this is the mail.log entry: Jun 30 18:27:46 vm21 postfix/smtpd[15682]: warning: ::1: address not listed for hostname localhost Jun 30 18:27:46 vm21 postfix/smtpd[15682]: connect from unknown[::1] Jun 30 18:27:46 vm21 postfix/smtpd[15682]: NOQUEUE: reject: RCPT from unknown[::1]:...

How to set watchpoint via procfs in Linux?

Hi I'm trying to build a debugger-like program under ubuntu linux and I've run into some problems... From what I've heard, the /proc vfs provides mechanisms to create watchpoints, but I can't seem to find out how. Some man pages pointed me to 'control file's, supposedly located at /proc//ctl, but I can't find this file anywhere. (Perh...

List only numeric file names in directory

I have a list of files with numeric file names (e.g. #.php, ##.php or ###.php) that I'd like to copy/move in one fell swoop. Does anyone know of an ls or grep combo command to accomplish this objective? I do have this much: ls -al | grep "[0-9].php" ...

Log controller requests to syslog in tg2

Is there any built-in automate way to log controller request events to system log? ...

How it's better to invoke gdb from program to print it's stacktrace?

Now I'm using function like this: void print_trace() { char pid_buf[30]; sprintf(pid_buf, "%d", getpid()); char name_buf[512]; name_buf[readlink("/proc/self/exe", name_buf, 511)]=0; int child_pid = fork(); if (!child_pid) { execlp("gdb", "gdb", "-batch", "-n", "-ex", "set pagination off", "-ex"...

Zip function for shell scripts

I'm trying to write a shell script that will make several targets into several different paths. I'll pass in a space-separated list of paths and a space-separated list of targets, and the script will make DESTDIR=$path $target for each pair of paths and targets. In Python, my script would look something like this: for path, target in zi...

copy a file and change its permissions in Linux with C

I copy a file by opening the source in read-only mode and the destination in write-only mode. It's simple and it works. The problem is that sometimes I am copying a file that sits on an NFS drive, or other network drives and when in these cases the permissions get all screwed and SELinux complains. I then go and manually set the permiss...

where is the timeout for SIGTERM handlers before killing the process when linux shutdowns configurated

I'm trying to debug a java shutdownhook problem. These shutdown hooks use SIGTERM + a watchdog thread. I suspect either a bug in the watchdog thread or a bug in my serialization process, but can't eliminate the second possibility, since i can't debug (even writing to file), so i'd like to increase the timeout to debug, but i don't know w...