linux

Asynchronous shell commands

I honestly can't believe I can't find a solution for this online. I've run across a few things that seem similar, but nothing that really does what I want... I'm trying to use a shell script to start a command. I don't care if/when/how/why it finishes. I want the process to start and run, but I want to be able to get back to my shell im...

makefiles and using eclipse for Linux programs and C++

Hi there, can anyone point me in the direction of a good tutorial on how makefiles work and also how to start a basic program from scratch using eclipse? I am using eclipse version 3.4.1 for fedora and C++. Thanks in advance. ...

Write a C program to measure time spent in context switch in Linux OS.

Can we write a c program to find out time spent in context switch in Linux? Could you please share code if you have one? Thanks ...

Why I cannot use my GMP library in Linux

Hi, I was writing some codes in linux using c. When tried to compiled, I got this response: /tmp/ccW8mQDx.o: In function `main': server.c:(.text+0x3e): undefined reference to `__gmpz_set_str' server.c:(.text+0x5a): undefined reference to `__gmpz_set_str' In fact, all the functions of gmp that I used couldn't be found. Seems there ar...

RXTX and Serial USB : Hotplug management on linux/windows

Hi everybody. I'm writing an RXTX based code in order to detect the plug and unlug of a USB serial device on linux/windows. public class PortMonitor implements Runnable { String portname; boolean life = false; CommPort p = null; public PortMonitor(String name) { this.portname = name; } public void s...

How would I use a socket to have several processes communicate with a central process?

For my application, I need to have a central process responsible for interacting with many client processes. The client processes need a way to identify and communicate with the central process. Additionally, the central process may not be running, and the client process needs a way to identify that fact. This application will be running...

shell script to add list of domains to apache vhosts

I have a list of ~900 domains that I need to set up on a linux/apache server. It would be absolutely brutal to create all of the users/groups/vhosts by hand. Does anybody know of a resource that I could use to automate this? I guess the script should do these actions: Read text file line by line in to array For each item in array: User...

Where to start learning about linux DMA / device drivers / memory allocation

I'm porting / debugging a device driver (that is used by another kernel module) and facing a dead end because dma_sync_single_for_device() fails with an kernel oops. I have no clue what that function is supposed to do and googling does not really help, so I probably need to learn more about this stuff in total. The question is, where t...

Measuring process statistics in Linux

I am building programming contest software. A user's program is received by our judging system and is evaluated by compiling it and running it via a fork() and exec(). The parent process waits for the child (submission's process) to exit, and then cleans it up. To give useful information about the program's run, I want to measure the CP...

Detect directory changes in unix

How could I track changes of specific directory in UNIX? For example, I launch some utility which create some files during its execution. I want to know what exact files were created during one particular launch. Is there any simple way to get such information? Problem is that: I cannot flush directory content after script execution Fi...

Generating a Core Dump File of a child process

I'm trying to run gpg from my php script using exec(). But it chashes with segmentation fault: "gpg: Segmentation fault caught ... exiting" It crashes within a child process so my php script works ok. To identify a problem I wanna get a core file. I tried to run ulimit -c unlimited echo 1 > /proc/sys/fs/suid_dumpable I added "* soft...

Issue with echo and tab in Bash

Hey, I would like to know if its possible to do formatting using echo in shell scripting. Here is a small code snippet which is giving me the problem echo -en "\rFileName : $filename : $index of $lines Completed" The Filename's is a string with varying length and this is causing problem with formating in the terminal. How ...

Limiting upload bandwith from client to proxy using Squid

I am trying to limit the upload bandwith from all clients to my squid proxy acting as a transparent proxy. I tried to use delay_pools for this, but my clients are still able to upload at full speed. Is there a way to create a delay_pool that will limit the bandwidth between my client and the proxy server? Thanks, Ariel ...

How to resume CUPS printer from command line

Hello I have printer in CUPS that due driver problems (hp 1010) form time to time goes into pause. I would like to write a shell script that will be once per hour resuming printer in cups. But I have no idea after googling for couple of minutes how to resume printer from shell command line. Regards Stan ...

Have a Linux shell script stuff a string into a Windows user's copy/paste buffer

We have a script right now which our Windows users run on a Linux host by way of putty. From time to time the script produces a string that the user must copy and paste into a Windows application. Without running a full-blown X display server on the Windows box, I'd like to modify the script so that the string is populated in the Windo...

Imports in Python project with doctests

Hi. I have a Python project with following directory structure: /(some files) /model/(python files) /tools/(more python files) ... So, I have Python files in couple subdirectories and there are some dependencies between directories as well: tools are used by model, etc. Now my problem is that I want to make doctests for both models ...

wxWidgets linking problem

I installed wxWidgets-2.8.10 following instructions from this page: http://wiki.wxwidgets.org/Compiling_and_getting_started Libraries directory: alex@alex-linux:/usr/local/lib$ ls | grep wx libwx_base-2.8.a libwx_base_net-2.8.a libwx_base_xml-2.8.a libwx_gtk2_adv-2.8.a libwx_gtk2_aui-2.8.a libwx_gtk2_core-2.8.a libwx_gtk2_html-2.8.a ...

Custom script in .screenrc

Hi. I made a script that spawns a remote shell or runs a local shell whether it's on the current machine or not: #!/bin/bash # By: benoror <[email protected]> # # spawns a remote shell or runs a local shell whether it's on the current machine or not # $1 = hostname if [ "$(hostname)" == "$1" ]; then bash else ssh "$1.local" fi...

Listing files and directories writable by the group in Linux

What's the easiest way to recursively list files in a given directory and its subdirectories, that are writable by the group which owns them? I'm using Debian 5. ...

Best server-side language for MySQL and PHP

So I have access to a dedicated server and want to finally create my game - it's a browser based game, fairly simple. I know PHP and MySQL fairly well and would want to integrate with them on the front end. The question is what is a good server-side language to use either as a constant process or with cron to interface with the MySQL d...