unix

Launching an independent process from php (via httpd)

Hi, i'm trying to spawn a daemon-like process from php on a unix environment, keep the pid for reference and keep it completely independent from httpd processes. This is useful for controlling middleware applications from administrative backoffices. I want to keep it generalized to reuse for any command, i don't want to write a .sh for ...

nohup for child process in unix

If I nohuped a parent process in unix, will the spawned child processes have the same protection as their parent?. Suppose, nohup par-process.sh & and if par-process.sh contains the call to child as, par-child.sh will par-child be nohuped or should I do that explicitly for it? Thanks in advance. ...

Piping output from ssh back to the local shell

Is there a way, from ssh, to get output back to the shell ssh was invoked from, kind of like :! in vim? For example, say I'm grepping a file for 'bananas' on a remote server, and I want to copy the output to an IM window - is there a way to invoke pbcopy on my local machine, or am I stuck selecting/copying from the terminal window? In ...

Matlab - run file without opening GUI, then quit

I want Matlab to run some .m file, which writes to a text file. I don't want the GUI to launch, and I don't want the command line interpreter to run. I've got matlab -nodisplay -r myfile But this still runs the interpreter. What options should I be using? ...

installing valgrind in ssh client

I am new in Unix, can somebody kind to tell me how to install valgrind in ssh client so that I can use valgrind command in my sunfire account? ...

Read system Call

Hi, I am trying my hands with unix socket programming in C. But while reading I am getting Err No as 4. I am unable to find out the description of this error code. Does anybody have any idea? ...

unix bash command

How to write a bash command that finds all files in the current directory that contain the word “foo”, regardless of case? ...

running scripts parallely and sequentially unix

I have the following requirement where there are 3 scripts say, a2,a3,a4 Now as per the requirement a2,a3 should be executed parallely and a4 sequentially.(ie., a4 should be executed only after the completion of a2&a3). Now I tried this like, ((((echo 'start a2' `date`; nohup a2; echo 'end a2') >>log) &) (((echo 'start a3'; nohup a3; ...

if [ $? -ne 0 ] then syntax error then unexpected

Hi all, I have been trying to execute the following unix shell script which is not working. I am running it by ksh. echo $?; if [ $? -ne 0 ] then failed $LINENO-2 $5 $6 fi failed() { echo "$0 failed at line number $1"; echo "moving $2 to failed folder" } This is giving an error saying "Synatx error:then unexpected". Basicall...

need to connect to two different db from sqlplus

I need to take information from two different data bases. select * from TABLE_ONDB2 where column_on_db2 in ( select column_on_db1 from TABLE_ONDB1 ); Problem is both are on different db instances so I am not able to figure out how to put table names and column names etc. I hope my question is clear. ...

Powershell vs UNIX

Greetings, I would like to know if there is any equivalent Powershell commands for the following UNIX commands: make trap Thanks. ...

How to write a C or C++ program to act as a memory and CPU cycle filler?

I want to test a program's memory management capabilities, for example (say, program name is director) What happens if some other processes take up too much memory, and there is too less memory for director to run? How does director behave? What happens if too many of the CPU cycles are used by some other program while director is runn...

shell script help - checking for file exists

I'm not sure why this code isn't working. Its not going to the copy command. I successfully run this manually on the command line (without the check) I don't think i'm performing a correct file check? Is there a better, cleaner way to write this? I just want to make sure the file exists, if so, copy it over. Thanks. #!/bin/bash if [ $...

SIGHUP equivalent in powershell

I am interested in knowing if we can catch SIGINT, SIGHUP equivalent signals in Powershell and how to do it? I also could not find if there is anything equivalent in powershell like "stty -echo" in unix environment. Thanks, ...

What does "loop" mean in "loop device"?

Hi geeks, This maybe a linguistic question. I have checked the loop device on Wikipedia. It is just for mounting files as block device. But what does "loop" mean here? Its usage here is totally bizarre to me. I am not a native English speaker. So could someone explain this jargon to me in plain English? :) Thanks. ...

understanding sudoers

I have a unix script which creates a temporary log file, say tempfl.log. When this file is created it has permission rw-r--r--. There is a line chmod 0440 /etc/sudoers tempfl.log 2>&1 But when the script is done the permission changes to r--r--r-- but it should be rw-r--r--. If I change the line to chmod 0644 /etc/sudoers tempfl.lo...

OS X can't find ANY libraries!!

I recently had some HD issues and had to get a new one. I transferred over my data using Migration Assistant on my freshly imaged disk. Then with but a minute left until I was in the clear, there is a town wide power outage. I was at work and had no backup generator and the university's didn't source the outlets, so my transfer was stopp...

smarty template compile directory not writable

hello all, i'm using the latest version of smarty (3.0rc3). i made my templates_c directory writable in command line (chmod -R 777 templates_c) but smarty still outputs this when i call $smart->utility->testInstall(); Testing compile directory... FAILED: ./php/classes/smarty/templates_c/ is not writable. Warning: rename(/tmp/wrtub1GxS,...

How do I create a memory-mapped file without a backing file on OSX?

I want to use a library that uses file descriptors as the basic means to access its data. For performance reasons, I don't want to have to commit files to the disk each before I use this library's functions. I want to create (large) data blobs on the fly, and call into the library to send them to a server. As it stands, I have to write ...

determine file permissions for the current user

I am looking for a way to determine file permissions for the current user (i.e. the process's UID) on POSIX-compliant systems. I don't want to try opening the file - that could get messy with directories and all kinds of special files. I am compiling a directory listing of a specified directory, and for each file, reporting a bunch of t...