General :: Getting Return Status Of Popen Sys Call?
Mar 22, 2011
i using Popen() sys call in my code to run a script. i know it will return file pointer. but requirement is some how i need to get return status of process which is invoked by popen. there any possibility to get its status, if so please let me know. FYI i cant use system() here becoz of some limitations
View 5 Replies
ADVERTISEMENT
Jul 8, 2011
I am running an embedded Linux Release 2.4.19-uc0.
I have code in several places that calls
reboot(LINUX_REBOOT_CMD_RESTART)
successfully. I need to put it into a new place in a application running on the system. When I do, it seems to just lock up the system and does not return from the call nor leave me able to Telnet in or Ping or anything. I've tried puttingtrace code in to write info out to a file, but that too is not working (as it never returns from the reboot() call.I don't get any error from reboot(), it just does not return and does not appear to restart the system.
View 3 Replies
View Related
Sep 25, 2010
I try to fetch links from a URL using HTML::LinkExtor, but it always return 0 links even if the status code is 200 OK. I am running the following code in Ubuntu 9.04, just curious if the module is too old and its ways of HTTP request is disabled by some platforms.
Code:
#!/usr/bin/perl
use HTML::LinkExtor;
[code]...
View 2 Replies
View Related
Jan 30, 2011
A strange question, I guess. I'm running processes called from a c main program. The calling is performed (for now) as: FILE * res=popen(ulimit -t 1; prg args); So I can read the stdout of the process as a file and analyze it. The time limit is important for me.
2 questions:
1. How do I get to know if the process terminated on its own or by the ulimit?
2. How do I limit to times that are less than 1 sec (I have many of those).
I know that setrlimit exists, just before I change my whole approach I wanted to see if I can deal with these things from the outside.
View 2 Replies
View Related
Sep 17, 2010
I don't seem to find a conclusive answer to this one...."Is popen thread safe via pthreads?"
View 2 Replies
View Related
Dec 12, 2010
Is it ok to read a process output with fgetws? I get segmentation fault when I try that.
Code:
#include <iostream>
#include <cstdio>
int main()
{
wchar_t line[4096];
[Code]...
I can read the output from the process if I use fgets instead of fgetws.But I am getting special characters in the output for some commands, that is why I wanted to try with fgetws.
View 4 Replies
View Related
Jul 21, 2010
I've got a (very) simple perl xinetd server that I'd like to port to C++. implement something similar using system() or popen() without success.
[code]...
View 14 Replies
View Related
Nov 29, 2010
In practice I have a script that call a java program that call a linux system command. The script if I run it, from a shell functions well,so it is not a java problem. The problem come out when i put this script in a crontab schedulation. The result in this case is that java do not execute the system command. I think it depends on crontab
View 4 Replies
View Related
Jul 5, 2010
I have just upgraded to Lucid on Ubuntu. I am a long time Pidgin user. I tried using Empathy with Gwibber, but I can't get Gwibber to update my IM status(es) in Empathy, so I want to go back to using Pidgin. (Additionally, I can't get Skype to work with Empathy.)I installed pidgin-microblog and pidgin-mbpurple, and they allow me to view my Twitter feed in Pidgin and update my Twitter status in Pidgin. However, in Karmic, I was also able to specify certain "status availabilities" (one named "Twitter-Available" and one named "Twitter-Away", for instance) to have the IM status message for these statuses become populated with my Twitter feed. This capability seems missing in pidgin-mbpurple in Lucid (and it seems to be the only thing missing from Karmic).
Is there a way to have pidgin-mbpurple update certain "status availabilities" in Lucid (and I'm just missing something) or is this no longer possible?Equivalently, is it possible to have Gwibber update my status message in Empathy? (I just want to be able to update my status once on one of my three computers - and have it propagate to all my other accounts (IM and social networking) and computers).
View 1 Replies
View Related
Aug 12, 2009
ok, I pressed alt-ctrl-f1 and it displayed my screen with a gui. I then pressed alt-ctrl-f2 and it displayed a textual desktop. I pressed alt-ctrl-f3 and it displayed the same thing. When I pressed alt-ctrl-f1 to return to my gui, it would not let me return to a gui. I was stuck in a cmd line textual desktop.
How, without restarting, do i return to a gui once I press alt-ctrl-f2??
View 3 Replies
View Related
Mar 16, 2011
After a fresh installation of Ubuntu 10.10 I uninstalled empathy (im using skype). The empathy menu in the evolution indicator was gone after that.I also uninstalled gwibber. But the gwibber status indicator remains within the about-me panel... Uninstalling the gwibber package also removes the me-menu which I want to keep actually. Especially the shutdown/restart... part of it. See attachment.I know there is a shutdown panel-app...but its butt-ugly and it doesnt allow to logon/off.
In another thread I read that the gwibber status shouldnt be there if no account for it is configured... which it is not... I do use ubuntu-one though which is in the same menu... I saw that this issue was addressed at some bug report before, but not fixed yet...
Does anybody know a good workaround to get rid of the gwibber status in the panel while keeping the about me and the shutdown button?
View 3 Replies
View Related
Jul 3, 2010
I have an Ubuntu Linux on a VMWare running and I've installed RPM Package Manager. However when I try to query all packages using the rpm -qa command, I don't get any results returned.
View 2 Replies
View Related
Jan 13, 2010
I'm trying to get a return value from the command running within screen. I have tried
Code:
screen "some_command ; echo $? > retval"
but this refuses to write "retval".
[code]....
View 1 Replies
View Related
Feb 11, 2010
I am writing a script that will give me the network address that a host belongs to, for example if a machine has a ip address of 192.168.1.4 I want the script to give me 192.168.1.0.
I am able to get the ip address echoed using:
Code:
I am having trouble getting the ip address stored as a variable so I can work with it, below is what I have
Code:
View 7 Replies
View Related
Jul 20, 2010
Alex accidentally deletes his PATH variable.what are some of the problems he may soon encounter and explain the reasons for these problems. How could he easily return PATH to its original value?
View 14 Replies
View Related
Apr 19, 2011
why does md5sum return a dash at the end:
Code:
$ md5sum
string290350295 -
How can I remove this using the md5sum tags?
View 2 Replies
View Related
May 15, 2010
I have called an script in cronjob named get_mac.sh as follows:
#!/bin/sh
MAC=`ifconfig eth0 |sed -n 1p|awk '{print $5}'|awk -F : '{print $1$2$3$4$5$6}'`
ARG_FILE="/etc/asterisk/scripts/server.params"
[code]....
View 1 Replies
View Related
Jul 27, 2010
I am trying to automate yum update of specific package on a remote machine.So far I have this:
#!/bin/bash
# Update my system
if ! yum update w3m
then
failure=1
[Code]...
View 3 Replies
View Related
Apr 10, 2011
i want to know how to call the other file in linux. example i got this code that store into example1.sh and i want to store the data into other file like example2.
View 2 Replies
View Related
Apr 2, 2010
I tried to format my harddisk (160 GB) with the following command
dd if=/dev/zero of=/dev/sda
After some 3 hours, following error came up:
dd: writing to '/dev/sda' : No space left on device
312581809+0 records in
312581808+0 records out
160041885696 bytes (160 GB) copied, 10708.3 s, 14.9 MB/s
View 2 Replies
View Related
Nov 7, 2010
What is a Linux command that I can run to programmatically return either 32 or 64 to indicate whether the processor is a 32 bit or 64 bit processor?
View 4 Replies
View Related
Sep 14, 2011
In my .bashrc I have the following lines to turn on colors for grep and ls alias ls='ls --color=auto'export GREP_OPTIONS='--color=auto'.I've tried changing the alias to export LS_OPTIONS='--color=auto' but that doesn't work.Is there anyway to use an export instead of alias. And are there actually any benefits to one way over the other?
View 2 Replies
View Related
May 2, 2011
getting a error return code for useradd commandthe return code is 1cite or tell me the explanation of return code 1 .
View 1 Replies
View Related
Mar 17, 2011
each time my linux is booting, it check something like eth0 and something else. but there is something i write below that fail... Code: could not receive return value from daemon proccess?
View 3 Replies
View Related
Jul 9, 2010
I have a script in /etc/rc.d/init.d named foo. I want to start/stop/restart my process as follows:$ foo start But I do not see the [OK] message once it starts. There is no shell prompt returned either. It seems that my own process is the problem. The executable that foo calls is built from this sample code:
int main()
{
do {
printf("Hello world
");
sleep(1);
} while (1);
}
Do I have to return some kind of signal handle for this to work?
View 6 Replies
View Related
Mar 31, 2011
I need to get a return code for the command ldapmodify.I try this and didn't workrc=ldapmodify -a -v -c -p $PORT -h $SRV -D cn=$USR,cn=Users,dc=company,dc=com -w $PWD -f $LDIFFILENAMECOUNTecho "return code " $rc what exactly the way to get the return code of that ?
View 2 Replies
View Related
Mar 18, 2011
my code is very simple:
int pid, status;
printf("parent process id=%d, to call fork
",getpid());
if(pid=fork()<0)
[Code].....
but everytime I can only get two fork return pid=0. In parent process, the pid returned by fork() should be >0 and equal to the child process id.
View 1 Replies
View Related
Feb 18, 2011
How can I pass carriage return to a command. I am writing a shell script whcih generates ssh key pair. It ask for input from user three times. I want to pass carriage return (ie. press Enter button) to this command. Is tehre any way
View 8 Replies
View Related
Mar 9, 2010
I have a text file have carriage return code ^L , ^K , I can use vi to read this code , can advise if I want to see this code , what can i do
View 4 Replies
View Related
Mar 20, 2011
I would like to return the last part of a string in an array of strings in bash.
The array contains in each position the content below:
Code:
a.b.c
a.d.f
a
a.d
[Code].....
View 5 Replies
View Related