linux

Start java process at boot and auto-restart on death

I have two requirements for my Java app. If it dies, restart it. If the server reboots, restart it - simple enough. Using the answer here I have a script that will restart when the java application dies. #!/bin/bash until java -Xms256m -Xmx768m -jar MyApp.jar; do echo "MyApp crashed with exit code $?. Respawning... " >" and it...

running sparc solaris dynamic binary on sparc linux

I have dynamic linked binary for SPARC/Solaris and want to start in on SPARC linux. Is it possible? I have sources of the program, but when I compile it with modern GNU Fortran it does not work and do an infinite loop. Program is computation mathematics and I can't solve such loop easy. ...

Is there any way to determine whether a linux executable is using soft float on an ARM processor?

Is there any way to determine whether a linux executable is using soft float on an ARM processor? Thanks, Ben ...

how to read list of running processes on a remote computer in C++

What can be done to know and list all running processes on a remote computer? One idea is to have a server listening to our request on the remote machine and the other one is to use ssh. The problem is i dont know whether there will be such a server running on the remote machine and i cannot use ssh because it needs authentication. Is th...

zcat files in and not in gzip format

I have all my Apache access log files as access.log, access.log.1 access.log.1.gz etc... What I want is to zcat all files in and not in gzip format and pipe them into an X program. I know I can do: zcat /var/log/apache2/access.log.*.gz | someapp... but that will just work for *.gz and not the first two logs. Any ideas will be appreciat...

Does the Thundering Herd Problem exist on Linux anymore?

Many linux/unix programming books and tutorials speak about the "Thundering Herd Problem" which happens when multiple threads or forks are blocked on a select() call waiting for readability of a listening socket. When the connection comes in, all threads and forks are woken up but only one "wins" with a successful call to "accept()". In ...

Most reliable way to identify the current user through a sudo

I have an application that may or may not be run while users are sudo'ed to a shared user account. I would like to reliably identify who the real user is for a sort of "honor-system" ACL. I think there's some way by tracing parent/group/session process ids the way that the pstree command does, but I'm not sure how to do that best or if...

How can you find the processor number a thread is running on?

I have a memory heap manager which partitions the heap into different segments based on the number of processors on the system. Memory can only be allocated on the partition that goes with the currently running thread's processor. This will help allow different processors to continue running even if two different ones want to allocate ...

Server Architecture for Embedded Device

I am working on a server application for an embedded ARM platform. The ARM board is connected to various digital IOs, ADCs, etc that the system will consistently poll. It is currently running a Linux kernel with the hardware interfaces developed as drivers. The idea is to have a client application which can connect to the embedded device...

Match URL link from input string

How do I match the URL address in this string, I have other code that matches text and it seems to work, but when I try to use it here, it doesn't, it keeps saying there is "No such file or directory. I didn't know grep -o only worked on files? matchString='url={"urlPath":"http://www.google.com/","thisIsOtherText"' array=($(grep -o 'url...

What's the difference between -> result=$(ls -l) (or) -> result=`ls -l`

I'v run both commands and they both seem to do the same thing, is this true or is there something happening I'm not seeing? These two appear to do the same thing: result=$(ls -l) result=`ls -l` ...

Www-data User to Access files/folder outside of /var/www/

Ok, is there a way for the PHP user (www-data) to gain access to other parts of the server, for example, /home/username/another_folder/ ?? Thanks in Advance. Will EDIT: Do I just add www-data to another group?? Or something like that, or is there another way? ...

what type of data structure would be efficient for searching a process table

i have to search a process table which is populated by the names of processes running on a given set of ip adresses. currently i am using multimaps in C++ with process name as key and ip address as the value. is there any other efficient data structure which can do the same task. also can i gain any sort of parallelism by using pthreads ...

Linux: How would I pipe text into a program properly?

I've looked but can't find anything. A program for example, a TTS I use lets you do the following: ~#festival -tts | echo "I am to be spoken" Which is really nice, but for programs I use such as hexdump, I don't know how to pipe text into it. I can REALLY use some of these things, some examples I tried (but failed) are like so: ~#gte...

ptrace'ing of parent process

Hello Can child process use the ptrace system call to trace its parent? Os is linux 2.6 Thanks. upd1: I want to trace process1 from "itself". It is impossible, so I do fork and try to do ptrace(process1_pid, PTRACE_ATTACH) from child process. But I can't, there is a strange error, like kernel prohibits child from tracing their parent...

ldd shows varied addresses on x86 Linux

I am using ldd to show the dynamic library on Fedora/x86 and it shows different results each time used? Is that expected? Or any explanation? I remember it shows a fixed result on PPC/Linux. `ldd /bin/ls linux-gate.so.1 => (0x00e5b000) librt.so.1 => /lib/librt.so.1 (0x00c0c000) libselinux.so.1 => /lib/libselinux.so.1 (0x0095d000)...

SVN Import: "Error: Could not open the requested SVN filesystem"

Hi All! I try to import my old project to new SVN server (svn + web_dav+apache), but however I get some weird error while importing with tortoiseSVN. Adding: C:\tmp\carpirate\test Adding: C:\tmp\carpirate\test\crawlerTestSuite Adding: C:\tmp\carpirate\test\crawlerTestSuite\TestP2p.java Adding: C:\tmp\carpirate\test\crawlerTestSui...

Create a symlink without shell access and in safe mode?

On a shared hosting package running the LAMP stack and PHP, with no shell access and PHP in safe mode (= exec() being disabled), with only FTP access, do I have a chance of creating a symbolic link somehow? I just checked, I can't even use the sneaky workaround of inserting a cron job that executes the ln command. ...

With sed or awk, how do I match from the end of the current line back to a specified character?

I have a list of file locations in a text file. For example: /var/lib/mlocate /var/lib/dpkg/info/mlocate.conffiles /var/lib/dpkg/info/mlocate.list /var/lib/dpkg/info/mlocate.md5sums /var/lib/dpkg/info/mlocate.postinst /var/lib/dpkg/info/mlocate.postrm /var/lib/dpkg/info/mlocate.prerm What I want to do is use sed or awk to read f...

What interprocess locking calls should I monitor?

I'm monitoring a process with strace/ltrace in the hope to find and intercept a call that checks, and potentially activates some kind of globally shared lock. While I've dealt with and read about several forms of interprocess locking on Linux before, I'm drawing a blank on what to calls to look for. Currently my only suspect is futex()...