linux

Equivalent to GetTickCount() on Linux

I'm looking for an equivalent to GetTickCount() on Linux. Presently I am using Python's time.time() which presumably calls through to gettimeofday(). My concern is that the time returned (the unix epoch), may change erratically if the clock is messed with, such as by NTP. A simple process or system wall time, that only increases positiv...

Still don't understand file upload-folder permissions

I have checked out articles and tutorials. I don't know what to do about the security of my picture upload-folder. It is pictures for classifieds which should be uploaded to the folder. This is what I want: Anybody may upload images to the folder. The images will be moved to another folder, by another php-code later on (automatic)....

Program to open large MySQL dumps

Is there a GUI program that can read large MySQL dumps (+200MB), or really any large text file? Most modern editors it seems can't handle large files because it seems they like to load the whole file into memory. I want to open it on Ubuntu (Linux), but I would also like to read it on Windows. ...

Shell script to count files, then remove oldest files

I am new to shell scripting, so I need some help here. I have a directory that fills up with backups. If I have more than 10 backup files, I would like to remove the oldest files, so that the 10 newest backup files are the only ones that are left. So far, I know how to count the files, which seems easy enough, but how do I then remove...

Unable to install pyodbc on Linux

Hi, I am running Linux (2.6.18-164.15.1.el5.centos.plus) and trying to install pyodbc. I am doing pip install pyodbc and get a very long list of errors, which end in error: command 'gcc' failed with exit status 1 I looked in /root/.pip/pip.log and saw the following: InstallationError: Command /usr/local/bin/python -c "import...

What is the effect of running an application with "Unlimited Stack" size

Hello All, I have inherited some code that I need to maintain that can be less than stable at times. The previous people are no longer available to query as to why they ran the application in an environment with unlimited stack set, I am curious what the effects of this could be? The application seems to have some unpredictable memory b...

Run FFmpeg from Shell Script

Hello all, I have found a useful shell script that shows all files in a directory recursively. Where it prints the file name echo "$i"; #Display File name. I would instead like to run an ffmpeg command on non MP3 files, how can I do this? I have very limited knowledge of shell scripts so I appreciate if I was spoon fed! :) //if file ...

Finding an available network port on the machine

I'm trying to implement a simple FTP server (a variation of the EFTP protocol) in linux. When a client connects and sends the PASV command, the server should respond with a port number, so the client can connect to that port to transmit the file. How can the server choose a port number? Do I need to iterate through all the ports from 102...

Drupal does not recognize my website has been installed

After a successful Drupal install, I was trying to follow the security recommendations and reverted the settings.php file to 444 permissions (read, read, read). Then, all of a sudden, right after doing that, Drupal does not recognize the installation process was completed. It went back to the install screen. Worst of all. I did chmod ba...

Using awk to print all columns from the nth to the last

right now I have this line, and it worked until I had whitespace in the second field. svn status | grep '\!' | gawk '{print $2;}' > removedProjs is there a way to have awk print everything in $2 or greater? ($3, $4.. until we don't have anymore columns?) I suppose I should add that I'm doing this in a windows environment with cygwin...

find: missing argument to -exec

Hello all, I was helped out today with a command, but it doesn't seem to be working. This is the command: find /home/me/download/ -type f -name "*.rm" -exec ffmpeg -i {} -sameq {}.mp3 && rm {}\; The shell returns find: missing argument to `-exec' What I am basically trying to do is go through a directory recursively (if it has oth...

How to run command in the background and notify me via email when done

Hello all, I have the following command which will take ages to run (couple of hours). I would like to make it a background process and for it to send me an email when its done. For the cherry on the top, any errors it encountered should write to a text file when an error has occurred? find . -type f -name "*.rm" -exec ./rm2mp3.sh \...

"#exec cgi" command is ignored from html; same script runs as a "form post" command

Apache configuration files all appear correct; I've added the ExecCGI to the RootDirectory, although this file resides in the ScriptAlias directory so that shouldn't even be necessary. I put a .htaccess file out there which is also probably not necessary. This is a simple counter.cgi file - runs fine from the linux command line; runs f...

Monitor file in Java on Linux 64bits

I'd like to be notified when a file has been created, deleted or changed, but not using polling mechanism. I have surveyed related Java API that can use.(EX:JNotify, JPathWatch and JXFileWatcher) Those APIs provide file monitor by using native component on OS. But I met the same problem is that they can't run on Linux 64bits, because n...

Compile C# as CGI

How do you compile a C# program as CGI to run in the cgi-bin of a LAMP/Linux/Apache server? ...

Preventing multiple process instances on Linux

What is the best way on Linux platform for the process (C++ application) to check its instance is not already running? ...

Why infinite recursion leads to seg fault

Why infinite recursion leads to seg fault ? Why stack overflow leads to seg fault. I am looking for detailed explanation. int f() { ...

special characters in file/folder names on Linux; Rename php function not working

I am using a function Rename() (php) to move some images from one folder to another. The destination folder has special characters in them. However, when doing this on the server I get the error that the folder isn't found with the name. And in that error, the folder names special characters are replaced with Squares: Warning: rename(...

linux + find word in file under directory but quickly

I have the following command find /var -type f -exec grep "param1" {} \; -print With this command I can find the param1 string in any file under /var but the time that it take for this is very long. I need other possibility to find string in file but much more faster then my example THX yael ...

How to grep curl -I header information

Im trying to get the redirect link from a site by using curl -I then grep to "location" and then sed out the location text so that I am left with the URL. But this doesn't work, it will outputs the URL to screen and doesn't put it test=$(curl -I "http://www.redirectURL.com/" 2> /dev/null | grep "location" | sed -E 's/location:[ ]+//g'...