linux

how to limit bandwidth used by mysqldump

I have to dump a large database over a network pipe that doesn't have that much bandwidth and other people need to use concurrently. If I try it it soaks up all the bandwidth and latency soars and everyone else gets messed up. I'm aware of the --compress flag to mysqldump which help somewhat. How can I do this without soaking up all th...

Limiting certain processes to CPU % - Linux

Hi! I have the following problem: some processes, generated dynamically, have a tendency to eat 100% of CPU. I would like to limit all the process matching some criterion (e.g. process name) to a certain amount of CPU percentage. The specific problem I'm trying to solve is harnessing folding@home worker processes. The best solution I c...

Fix gnu screen blocking reverse video

I alias screen to 'TERM=screen screen' in order to fix it from messing up some key bindings (e.g. switching delete and backspace) However, when I do this screen doesn't show some reverse video output -- for example, it works in vim, but not output from watch -d . If I run \screen thus avoiding the alias reverse video always works as exp...

Barebones Linux Server Install

Hi all, Whats the simplest way to get a barebones linux server installed? barebones = just enough to get ssh and package manager. Current I've been using CentOS with server install and removing any packages that I know i do not want installed. But is there a better way? I just want a simple ssh shell + package management to start with...

Architectural Suggestions in a Linux App

Hi, I've done quite a bit of programming on Windows but now I have to write my first Linux app. I need to talk to a hardware device using UDP. I have to send 60 packets a second with a size of 40 bytes. If I send less than 60 packets within 1 second, bad things will happen. The data for the packets may take a while to generate. But if ...

How do I POST LF with curl command line tool?

I'm trying to POST to the HTTP gateway of an SMS provider (Sybase 365) using CURL from a Linux shell script. I need to pass the following data (note the [ ] and LF characters) [MSISDN] List=+12345678 [MESSAGE] Text=Hello [END] If I submit a file using the -F parameter, CURL removes the LF e.g. curl -F @myfile "http://www.sybase.com/...

linux fcntl - unsetting flag

How do i unset a already set flag using fcntl? For e.g. I can set the socket to nonblocking mode using fcntl(sockfd, F_SETFL, flags | O_NONBLOCK) Now, i want to unset the O_NONBLOCK flag. I tried fcntl(sockfd, F_SETFL, flags | ~O_NONBLOCK). It gave me error EINVAL ...

Is there a way to check if an USB drive is stopped?

I've written a script to backup my server's HD every night. At the end of the script, I sync, wait a couple of minutes, sync and then I issue sg_start --stop to stop the device. The idea is to extend the lifetime of the device by switching the HD off after ten minutes of incremental backup (desktop disks will survive several thousand on/...

SFTP Rename file to append date

I'm sending a file from a mainframe host to a linux ftp sever using sftp. I want to append the date to the filename once the file resides on the linux box. (Ex: filename.txt becomes filename122308.txt) I have tried the 'rename' command using 'date +%m%d%y' - the file was renamed but the flags were not executed (The filename became file...

Alternatives to make for linux/freebsd?

What are some alternatives to make for linux/freebsd? ...

Queues in the Linux Kernel

I've been searching for information for a common kernel implementation of queues, that is, first-in-first-out data structures. I thought there may be one since it's likely something that's common to use, and there's a standard for linked lists (in the form of the list_head structure). Is there some standard queue implementation I can't...

Why can I not get system V message queues working with fork()?

I have a program here: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/ipc.h> #include <sys/types.h> #include <sys/msg.h> #include <sys/wait.h> #include <errno.h> #include "linkedlist.h" #include "globals.h" #include "card.h" #include "logging.h" #include "stack.h" #include "servers.h" #include "player.h" #de...

System V Msg Queues on Linux don't work as expected.

I have the following application which replicates an issue I'm having in a larger application with system v message queues. basically, the main function generates a key, then creates a message queue with msgget(). Then 3 forks are spawned, each with a different id. each of them runs msgrcv with a different posative number (so they are wa...

Why such a disparity in pricing between Windows and Linux hosting services

I'm a .Net developer for pay, but I have my personal web site hosted on a LAMP stack with a shared hosting provider. I've been looking for a while to switching to a Windows with .Net hosting provider, but what really turns me off is the price. The reason that I want to switch is that I find .Net much more enjoyable to develop on, and I...

How do I find out how much free memory is left in GNU C++ on Linux

I'm writing a C++ program (compiled with gcc and running on RedHat Linux). The program needs to know at runtime how much space is left on the stack and how much is left in the heap. I realize there may not be a definite answer to this question (about the heap), so alternatively, I could use the amount of memory already allocated from t...

SQL string formatter

Does anyone know of a program, a utility, or some programmatic library, preferably for Linux, that takes an unformatted SQL string and pretty prints it? For example I would like the following select * from users where name = 'Paul' be changed to something like this select * from users where name = 'Paul' The exact formatting i...

Best way to kill all child processes

I basically want to kill a whole process tree. What is the best way to do this using any common scripting languages. I am looking for a simple solution. ...

ssh tunnel for sendmail

I'm going nuts here, trying to get my system configured. I have a laptop at home and a workstation at work. I use mutt and sendmail. I have a home isp that is on a lot of blacklists, so that any email I send from my laptop through my isp is frequently blocked as spam by the receiver. I can ssh to my workstation and use mutt there inter...

PHP ignoring mysql_connect requests

I'm new to PHP and have installed on Linux to boot (also a newbie). Anyway, PHP is working... <? $myVar = "test"; echo($myVar); ?> ... works just fine. But... <? $dbhost = "localhost"; $dbuser = "myuser"; $dbpass = "mypass"; $dbname = "mydb"; echo($dbhost . "-" . $dbuser . "-" . $dbpass . "-" . $dbname); $conn = mysql_connect($db...

How to make Linux GUI "usable" when lots of disk activity is happening

If I start copying a huge file tree from one position to another or if some other process starts doing lots of disk activity, the foreground app (GUI) slows way down. For example, take a 2gb file tree with 100k files in it. Open a console and do cp -r bigtree bigtree2. Then go to firefox and start browsing. Firefox is almost unusable. Ev...