Programming :: Test If File Is In Use?

May 4, 2010

I want to copy files from an incoming directory, but don't want to copy a file if it hasn't finished being written. I thought of using fuser, but it doesn't seem to be very reliable. I vi'd a file in one window and then ran fuser against the file name and got nothing back. I'm just writing a simple bourne script on RHEL.

View 5 Replies


ADVERTISEMENT

Programming :: Insert A Line In The Test File With Sed?

Jul 15, 2010

I have following file workers file: There are 800 entries like this.

# consensus/uat
worker.consensus-uat1.host=lonlx10409
worker.consensus-uat1.port=13702
worker.consensus-uat1.type=ajp13

[code]....

I want to insert one line just below the line starting with "woker.list". I think sed can do it but I am not aware.

View 14 Replies View Related

Ubuntu Installation :: Warning - Can't Create Test File /var/lib/mysql/mosty.lower-test

Mar 15, 2010

I am trying to install mysql 5.1.44..so i downloaded the binary package, i extracted it and then followed the instructions that were in the manual but i keep getting this error when running this command

Code:

scripts/mysql_install_db --basedir=/home/mosty/mysql

the error is

Code:

Installing MySQL system tables...
100315 20:07:27 [Warning] Can't create test file /var/lib/mysql/mosty.lower-test
100315 20:07:27 [Warning] Can't create test file /var/lib/mysql/mosty.lower-test

[code]....

You can try to start the mysqld daemon with:

shell> /home/mosty/mysql/bin/mysqld --skip-grant &

and use the command line tool /home/mosty/mysql/bin/mysql to connect to the mysql database and look at the grant tables:

shell> /home/mosty/mysql/bin/mysql -u root mysql
mysql> show tables

View 1 Replies View Related

Programming :: Test Program To Get The CPU Utilisation

Mar 9, 2010

I wrote a test program to get the CPU utilisation. I hope to extend it to take cpu utilisation on multi core machines. Hear I used the equation for taking cpu utilisation given at [url] of JmSchanck post. But when I match the output of my program against 'top' and 'system monitor' output it seems quite high. Sometimes cpu utilisation goes more than 100%.

So the given equation in that url is correct? can anyone give me the equation to take CPU utilisation?

Code:

View 3 Replies View Related

Programming :: How To Get Grep Output 0 - 1 And Test It

Apr 7, 2009

I am trying to use a shell script to find a string in a file and do something when found. code...

What should happen is pppd will start in a different process and stream it's output to pppdout. pppdout should be created in the current folder. Then the script should periodically check the pppdout file for the string Script (which eventually will appear, some seconds later) and when found exit the script. Ultimately the script will do something useful when the text is found. However, the output from the program is a repeating: 'scriptname.sh: 12: FOUND: not found'

Where scriptname.sh would be the name of your script and 12 refers to the line with 'done'.

Why does grep not find the text, or at least why deos my script not check the grep output correctly?

View 10 Replies View Related

Programming :: How To Test Kate Plugins

Mar 20, 2011

I wanted to make some modifications to a Kate plugin, so I cloned the git repository, started doing a few changes, and it compiled. The problem is that when I run it, it uses the version of the plugin installed in the system, not the one compiled with Kate.

View 1 Replies View Related

Programming :: How To Test Whether A Macro Is Defined

Mar 20, 2011

I've been reviewing some source code recently which contains many conditional compilation statements, and I found it hard to understand the code not knowing whether some macro is defined or not. Is there any way to test whether a macro is defined?

View 2 Replies View Related

Programming :: Passing Input To Program For Test

Apr 13, 2011

I started to run a C++ my program in Linux and I don't know how to test my program that works fine with a text file. This is a project for my uni and to explain more clear, My program is a sample database for modify or add and search and it read data from a binary file and also write into a binary file. I have got an input from my lecture and she said after compiling in Linux I must write:

1-to compile:
Code:
g++ (files with cpp)
2-to see the output:
Code:
./a.out
3-to test with input:
Code:
./a.out < input.txt >

My problem is in step three. What I must write in the command part after" step2" to see the output?

View 3 Replies View Related

Programming :: How To Test Disown And Nohup Commands

Mar 20, 2010

I ran a perl script in background with nohup and disown to make sure my script runs even after the parent process is terminated.

Method 1: nohup
> nohup perl run.pl &
[1] 2080

Method 2: disown
> perl run.pl &
[2] 2448
> disown

In either method, the script process doesn't seem to connect to init process, when I checked using pstree command. I thought, the disown or nohup command detaches the process from its parent and attaches it to grand grand parent init process. And it disables SIGHUP signal to my script process. But the pstree command didn't show me what I expected. It still shows my script process attached to my current terminal process. I just don't understand the concept behind these two commands (nohup and disown). Is there any way, I can see the list of processes that are run by nohup or disown command?

View 2 Replies View Related

Programming :: Perl - Test If String Is Uppercase

Jan 6, 2010

In my perl script I'd like to test if a string is written in uppercase letters or not. How can I do that? This type of test don't seem to work, so there must be other ways of doing this:

Code:

...return true.

I can create a subroutine that compares each character aginst a list of uppercase letters, but I'm hoping there's allready a build in routine in perl that does this...

View 14 Replies View Related

Programming :: PHP - Ping Test In Shell / CMD Window

Mar 4, 2010

I'm trying to do the following. from a php webpage click on a link, that opens a shell/cmd and runs an open ping to the device. so it must actually open a shell (for linux) or cmd (for windows) and run a ping to the specified ip. Currently i'm running an exec command, but for this i need to wait for the result to be fetched and print it out. I want to monitor it in realtime, by just clickingon the button. How to get this working?

View 1 Replies View Related

Programming :: Test App That Scans For Plugins In A Directory?

Aug 27, 2010

I wrote a test app that scans for plugins in a directory, calls their getWidget() method (implemented in my interface), and adds that widget to a layout.

The problem is that when I added a QTimer to my plugin class, it didn't work! Why?

And will it be easier to write the thing in Python and not use QPlugin? I just want to define a QWidget and have it added to the app.

View 8 Replies View Related

Programming :: Script To Test If Program Is Running

Sep 22, 2010

I'm trying to test whether wget is working still or not. While [ wget is still running ] <----- but how should this look please?
do
codes
done

View 4 Replies View Related

Programming :: Python - Attempting To Test The Bin Function?

Jul 31, 2010

I am exploring the Python 3 standard library and am currently attempting to test the bin function. It converts an integer into a binary string. I believe the module I wrote is flawed somehow. Here's the source code:

Code:

#!/usr/bin/python3.1

#This module tests the bin() function.

import sys
def get_input():
x = input("Enter an integer: ")
def use_bin():

[code]....

As you can see, the binary form given is always 0b10111. I'm no expert on binary code (or hexadecimal notation), but surely 9000 and two would have different results?

EDIT: Added a line in the module to repeat back what integer the user entered, and then the binary form. It would appear that no matter what integer the user enters, Python thinks it's "23".

Example output:

Code:

>>>
Enter an integer: 1
You entered 23
The binary form of this integer is 0b10111
>>>

View 3 Replies View Related

Programming :: If Test Validation - Using Char Arrays

Jun 9, 2010

I'm writing a code to get the index of the last occurrence of a given substring in a string.

Code:
int StringHandler::lastIndexOf(string src, const string s) {
unsigned int lastIndex = string::npos;
if (src.find(s, 0) == string::npos) {
return -1; } else {
bool isLast = false; unsigned int i = 0; do {
lastIndex = src.find(s, i);
if (lastIndex != string::npos) { i = lastIndex + 1;
if (i == src.size()) { isLast = true;
} } else { isLast = true;
} } while (!isLast);
} return lastIndex;
}

My problem is: execution steps into an if with a false condition! Check the values of i and src.size() at the right panel. How could be possible for the program to run the highlighted statement? The if condition above is false! [URL]. I could use char arrays, for example, but this kind of false validation has happened to me more than once, I'm using G++ 4.5 with these flags: -O0 -g -Wall -c

View 3 Replies View Related

Programming :: Bash Script - Test Variable Against A Range?

Jan 28, 2010

I am fairly new to bash scripting, and I am trying to test a variable against a number range (1-3). This is what I have used so far: The user enters a value, then

while [ "$PROV" != "1" ] && [ "$PROV" != "2" ] && [ "$PROV" != "3" ] && [ $COUNTER -lt 4 ] || [ -z "$PROV" ] && [ $COUNTER -lt 4 ]; do
clear
echo

[code]....

Is there a cleaner way to do this? Something like:

while [ "$PROV" != "1-3" ]&& [ $COUNTER -lt 4 ] || [ -z "$PROV" ] && [ $COUNTER -lt 4 ]; do

View 3 Replies View Related

Programming :: Bash - Test If First 2 Characters In A Filename Are Numbers?

Oct 21, 2010

I have a directory with files like this:

Code:

And what I'd like is to have the files renamed like this:

Code:

How could I code it so that it removes the numerical part of the filename (at the beginning), even with different patterns (like the 01 - artist vs the 01-artist)?

View 8 Replies View Related

Programming :: Test New System Call Before Compiling Kernel?

Apr 2, 2009

I want to test my system call that be goint to add to kernel, But when i finish compiling kernel, i found my system call code not work. the code i want to return the system time "struct timespec":

/*----------Start of mycall.c----------*/
#include <linux/linkage.h>
#include <linux/time.h>
#include <linux/kernel.h>

[code]....

so i want a method to test the new system call before compiling kernel.

View 2 Replies View Related

Programming :: Do Not Miss Any Cases While Making The Test Case Doc?

Jul 28, 2010

Few months back I learnt a *few* concepts about bits/bytes and started writing a program for bit packing in C++. Now that program has grown upto 600 lines and I am still working on it. Yesterday I realized I missed some special cases due to which the program was malfunctioning. Now I have modified the program and it is working properly but I think If I would have designed all the possible test cases before writing the code, I would have finished the program long ago.

I. What is proper way to design the test cases before coding?

II. How should I make sure that I do not miss any cases while making the test case doc. ?

III. Does writing test cases prior to coding solve messy code issues or should I consider something else ?

View 8 Replies View Related

Programming :: Test Program Without Making A Copy Outside The Git Working Dir?

Jan 30, 2010

I was windering, if you are writing a C program, I don't think you are supposed to commit the .o files and executables. How can you test your program without making a copy outside the git working dir?

View 3 Replies View Related

Programming :: How To Configure And Use The Host To Boot A Test Kernel

Mar 8, 2011

I want to learning and developing the kernel on the practice(not kernel module). What are some ways to boot the test kernel on the same system(with stable kernel) where I`m building a test kernel for debugging purposes.

How to configure and use the host to boot a test kernel then I can boot the system(with stable kernel) and fix the test kernel.

View 8 Replies View Related

Programming :: Test If Client Or Server Has Data To Send C++?

Feb 16, 2011

If you have a proxy and receive/send data from/to both the client and the server,is there a way to test what part has data to send(client or server) ?

View 1 Replies View Related

Programming :: Make A Simple Vector Test But Can't Compile It?

Jun 6, 2010

I am trying to make a simple vector test program, but i can't compile it. Here is the code:

Code:
import java.util.*;
class Vec {
public static void main(String args [ ]) {

[Code]....

View 2 Replies View Related

Fedora Servers :: Several Postfix - Test Antivirus Scan Using Eicar Test Virus ?

Apr 8, 2009

I have installed Postfix + Amavisd-new, then I am started all services (and configured main.cf and master.cf to use amavis).

The questions are:

1) I am trying to test antivirus scan using eicar test virus

Code:

And the message is successfully delivered to mailbox with mark "CLEAN" in maillog. But I cant see any attachment using

Code:

Where is my mistake?

2) Should I update clam and how I can do it?

3) Is spamassassin enabled by default in amavis (I have started daemon)?

4) Where configuration files of spamassassin is stored?

View 1 Replies View Related

Debian Programming :: Uniqueness Test Failure On Wheezy / Virtualbox

Nov 15, 2013

Python's test case to test uniqueness of uuid.uuid1() in test_uuid.py is failing on wheezy on Virtualbox. However, when I change it to use uuid.uuid4(), it's successful always. I don't have wheezy installed on a bare machine to test.I faced this problem when installing Python 2.7.6 on my virtualbox. This is blocking a successful installation.

Below is a test file I created:
Code: Select allimport uuid
def test_uuid():
    uuids = {}
    for u in [uuid.uuid1() for i in range(1000)]:
       
[code]....

View 0 Replies View Related

Programming :: Faking IP Addresses To Test Servers On Internal Network

Jun 9, 2009

I'm in the process of setting up a script in perl to make 1,000's of curl calls to my companies application on our test server. Our software does all sorts of tracking of data based on IP addresses using geoIP, so i was wondering if anyone knew of a way to fake these addresses to the server?I know a big issue with the IP faking is the return path but i dont really need this. I also cant do it on the hardware level since the script is going to be picking lots of different IP's at random.Anyone have any idea if this is possible and if so, are there any known libraries i can use for this? I prefer perl but any Linux compatiblie scripting language is fine.

View 1 Replies View Related

Programming :: Writing A Script To Do A Speed Measurement From ISP's Test Ftp Server

Feb 5, 2010

I am writing a script to do a speed measurement from my ISP's test ftp server. To do this interactively I connect to the server, enter credentials, enable hash and download a test file. The process concludes with something like

Quote:

################################################################
226 Transfer complete.
1048576 bytes received in 2.87 secs (356.6 kB/s)

So I entered the credentials for the server in my .netrc file and created a little bash script as follows

Quote:

#!/bin/bash
cd ~/Desktop
# poiuytrewq is the limit string of the "here" document

[code]...

The script executes as expected EXCEPT that I do not see the statistics at the end of the transfer. It terminates thusly

Quote:

#################################################################################################### ############################################
ken@taylor12:~/Desktop$

I have tried adding another ftp command such as ls to the end of the "here" document (in case the results were clipped by the bye command) but to no avail. The ls result immediately follows the ### - no stats I am at a loss.

View 8 Replies View Related

Programming :: Test Permissions On All Files / Folders Into A Folder Recursive?

May 16, 2010

Way to test permissions on all files/folders into a folder recursive, then if those are not user:user then do :

Code:
chown user:user thatconcernedfile

The problem with that

Code:
chown user:user -R /folder

is that it is doing changes on file permissions whihch are already ok. If you wanna maintain a specific permission on a folder this is really not good this :

Code:
while [ 1 ] ; do
chown user:user -R /folder
# /folder contains 6.0 Tb
sleep 2s
done

View 1 Replies View Related

General :: Test File Sending Speed?

Jul 6, 2011

program to measure speed of sending file from one computer to another

View 1 Replies View Related

General :: Test PC To PC File Transfer Speed

Jul 7, 2011

I want a program that can be installed in two pc and measure speed of transfering files from one to another or any data measured in Mega bit

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved