Programming :: Exit In Script Files Cause Konsole Terminal Itself To Exit?

Apr 11, 2010

I noticed that if I have "exit" in a bash script file., e.g. script.sh,that when the word "exit" is reached, and the script file being executed is not in the PATH nvironment, i.e. ". script.sh", the whole konsole shell profile is exited! What gives here? Is there another command compatible to "exit" to prevent this, or will I just have the leave the "." part in the PATH enviroment, which is, to my understanding, is not recommended? I desire for a "goto" function in bash script files

View 11 Replies


ADVERTISEMENT

Programming :: Why New Threads Exit When Main Thread Exit

May 22, 2010

In linux, creating thread is same as process (clone()), except the virtual address space gets shared with the parent.If a running main process(thread) creates new thread, and if main thread exits, why should the new thread too exit? both are different entities, The same doesn't happen if the child thread exits, the parent thread would be alive.

View 1 Replies View Related

Fedora :: Echo Exit Status After Command Is Run In Terminal?

Feb 19, 2010

command will just execute and exit with a status of "0" -"Every command returns an exit status (sometimes referred to as a return status ). A successful command returns a 0, while an unsuccessful one returns a non-zero value that usually may be interpreted as an error code. Well-behaved UNIX commands, programs, and utilities return a 0 exit code upon successful completion, though there are some exceptions."[URL]With the command . . .

Code:

# dosfsck -v /dev/sdb

it could be very helpful (and decide my next move) to see the exit code as 0, 1, or 2 . the man page suggests the command exit code will specify if the message I get - "Cluster size is zero" (I think it is a "1")is a recoverable or fixable error by the utility. or is non-recoverable - a pretty nifty feature if I understand this right. [URL] is there anything like this script COMMAND_LAST used in the following link. [URL] that can be entered in the terminal window after - or at end of - my dosfsck command or any command. just to see if it has a 0, 1, or 2 status ?

View 2 Replies View Related

General :: Tomcat Stops Running When Exit The Terminal

Jul 10, 2011

I am trying to run Tomcat on Ubuntu System from a remote host. However, when I exit the terminal, Tomcat process shuts down.

The command I am using to run it is

nohup ./startup.sh &

View 1 Replies View Related

Programming :: Return And Exit In C

Jun 3, 2011

What are the uses of return 0, return 1 and exit statements in C

View 4 Replies View Related

Programming :: Bash - Propogate Exit Status ?

Jun 10, 2010

I am running a command pretty similar to the one below:

Code:

I need to capture the exit status of that part of the command.

What I am trying to do is set a variable that can be modified within my_job.sh, and used to exit.

However, no matter what I set "status" to in my_job.sh, it exits with "0".

What can I do differently?

View 3 Replies View Related

Programming :: Bash - Using Exit Status For Decisions

Mar 3, 2010

How exactly can I use the exit status of a command in an if statement ?

Something like this:

Code:

View 3 Replies View Related

Programming :: Gracefully Exit A Background Process?

Jun 7, 2011

I am using a program that reads in data from a serial port and then sends that data out over a TCP connection. The problem I'm having is that the only way I know to exit the program is to do a 'kill PID', but doing this means the program doesn't go through the motions of closing the TCP connection properly so I have to wait some random period of time for the port to free itself or else when I try to start it back up it tells me that it can't bind to the specified port.The general structure of the program is as follows

Code:
int main(){
// initialize some stuff

[code]...

View 1 Replies View Related

Programming :: Filer Doesn't Take Exit Command

Jul 6, 2009

I am trying to write a python script which logs into a NetApp filer and fetches some data. I am using the telnetlib library. Filer does not take exit command. So it expects Control-D. How to send that via python script?

View 5 Replies View Related

Ubuntu :: Extracting TGZ Files - Exit With Failure Status

Jul 20, 2010

I am trying to extract a .tgz file. I have used the command tar - xvwzf filename.tar but I get the following error:
gzip: stdin: decompression OK, trailing garbage ignored
tar: Child returned status 2
tar: Exiting with failure status due to previous errors
root@test:/datastore/Newfolder# tar -xvwzf filename.tgz

View 9 Replies View Related

Programming :: Typeset -i Failing And Return Exit Code 1

Nov 18, 2010

I have this command in ksh:

1. typeset -i INTEGER INTEGER=aaa In all platforms except of Linux it is failing and return exit code 1 Why in Linux it is not failing? I must it for my number tests

2. The same for printf command. Only in Linux the bellow command is not failing: printf "%d" aaa

View 7 Replies View Related

Programming :: Bash Syntax \ See 1 If The Exit Value Of Diff Is 0, And Otherwise Wanna See 0?

Dec 26, 2010

I'm new to scripting and I have a trouble with if statement syntax. The code is: Code: #there is a diff command here, and it does what i want but#i wanna see 1 if the exit value of diff is 0, and otherwise i wanna see 0.#the problem is here: (syntax error near unexpected token "then")

if["$?"==0];
then
echo 1

[code].....

View 1 Replies View Related

Programming :: C++: Program Crashes On Exit On Std::string Destructor?

Sep 24, 2010

i am wondering why the following simple code causes a segfault on exit,when the std::string destructor is called.

Quote:

#include <iostream>
#include <string>
using namespace std;

[code].....

I guess the memset messes with some internal std::string's data structures/pointers. I personally am anti-memset,and always avoid them.

View 4 Replies View Related

Programming :: Counting The Number Of Exit Variables - Bash

Jul 1, 2010

Is there a way to count the number of errors- an exit variable $? from one function?

The output from the exit variable (either erroneous or correct (1) or (0)) is it possible to add the erroneous one ups?

View 3 Replies View Related

Programming :: Run A Part Of Code On Exit In A Shell Script?

May 14, 2010

How do i run a part of code on exit in a shell script?Suppose i have four echo statements like the following:

echo "Stmt 1"
echo "Stmt 2"
....some code goes here...

[code]...

View 2 Replies View Related

Programming :: Script Exit Code To System() C Function?

Jul 3, 2009

Consider the following code:

Code:
...
int ret=0;

[code]...

View 4 Replies View Related

Programming :: Why Does A Child Exit When The Parent Receives A Signal

Mar 16, 2011

I have a problem with the last point of some homework I have for an OS class. I need the program to print the pid upon execution, then for 10 seconds react to SIGUSR1, SIGUSR2 and SIGTERM. If either USR1 or USR2 is received, the 10 seconds are reset. Some of the functions I'm told to use are alarm(), pause() and signal(). The nicest way I found was to handle SIGUSR1, SIGUSR2 and SIGALRM in the parent process, with SIGALRM killing the child (with a SIGTERM). In the child a pause() (or for(; pause() would be enough for it to be alive until killed from the SIGALRM handler in the parent.

What I found is that I can't just do a wait() in the parent process, waiting for the child to be killed, since whenever the parent receives a SIGUSR1 or SIGUSR2, the right handler is called but the child exits nicely. I tried blocking/ignoring those signals in the child, since the default behaviour for SIGUSR1 and SIGUSR2 is to terminate the process, but the result is the same. The only way I could do it is using a waitpid() within a do { } while(!WIFSIGNALED(status)) since when the child gets killed with the parent's kill(), it's WIFSIGNALED, whereas when it exits after the parent handles a SIGUSR1/2, it's WIFEXITED.

P.S. What I'm doing to achieve the expected 10s window is calling alarm(10) in the parent process and again within the SIGUSR1/2 handlers. In the SIGALRM handler I kill the child and within the child I simply do a for(; pause()

View 4 Replies View Related

Programming :: Capturing The Exit Status Of The Script Running In Background

Apr 10, 2010

I have a scenario where I am executing some child shell scripts in background (using &)through a master parent script.

Is there a way I can capture the exit status of each individual child script after the execution is completed.

View 7 Replies View Related

Programming :: Exit My Script W/o Leaving An Orphan Process Running

Dec 4, 2010

It's called TextRipper and it creates indexable and editable text files from any image. Feel free to copy TextRipper; it's licenced under GPL. My troubles are with cracking passworded pdf's. (As you can see, I meant any when I said any image.)

I can't find a way for the user to cancel the decryption process by exiting the script without pdfcrack orphaning. Line 349 works the rest of the time; the concerned process is line 228. I believe it's a piping/subshell problem. At least that's how I've been going at it in vain.

I've made portability a priority and that the comments still require updating.

Code:

If the result is one output file, TextRipper will open it for you in OpenOffice Writer.

Otherwise all txt output files (editable and indexable) will be in the original file's directory." 0 0

View 14 Replies View Related

Programming :: Bash - Ps - Psgrep And Read /proc/$pid Make Script Exit

Mar 22, 2011

I have not been able to write bash to use a PID file to ensure no other instance of the same script is running! All three methods I can think of to see if the PID in the PID file is another instance of the script make the script exit with a return code of 1 but the same commands run at the command prompt work as expected.

The first attempt was:

Code:

The first attempted workaround was:

Code:

The second attempted workaround (with debug to make the following command prompt copy and paste meaningful) was:

Code:

Here's the command prompt session, testing with a stale PID file and then manually running the problem command and it behaving as expected:

Code:

This on Slackware64 13.1 which has bash 4.1.7.

In desperation I tried rebooting but the behaviour was the same.

View 2 Replies View Related

Programming :: Physical Memory Leaked By User Application Process Is Not Reclaimed Back After Exit?

May 2, 2010

Whenever I'm running my application process, I've 1M physical memory usage is increasing for every 2 hours.This I observed using 'free -m' command.But 'top' command did not showing any increase 'RSS' size.It is same as it was started initially.Even though I stopped my process,the increased memory was not released back. If I start my application process then again memory usage start increasing by 1M for every 2 hours. increase of memory usage observer with 'free' and that too when my application is running, but top command is not showing any change in the RSS sizeIf my application is leaking any memory which is allocated by new/malloc, that should be released back whenever my application exit and the size increase will be show through top command for that process, right? This is not happeningThis proves that there is no potential leaks in my process.But why physical memory is increasing when only my process is running?

View 14 Replies View Related

Programming :: Get Bash Script Using Zentity To Exit If The User Presses The Cancel Or Close Buttons?

Feb 3, 2011

I am trying to get bash script using zentity to exit if the user presses the cancel or close buttons.The exit codes are working fine; they read 1 or 0 depending on the status but it always assumes 0. This is the portion of the script: PHP Code:

function settings(){
result=$(zenity --height=30 --width=300 --list --checklist --title='Selection'--column=Boxes --column=Selections --column="Options" 

[code]...

View 2 Replies View Related

Ubuntu :: How To Exit X Server With 9.10

Mar 18, 2010

I was wondering how you exited x server in ubuntu. I relatively new to linux. I wanted to install the newest nvidia driver, and they said you needed to exit x server when running the driver installer. Someone already told me to try ctrl-alt- F6, which didn't work. That just put me in a virtual terminal that still had x-server running. So if anyone knows how to exit x-server,

View 1 Replies View Related

Ubuntu :: What Are Exit Handlers

May 1, 2010

What are exit handlers ? They are piece of code to execute prior to exit() ?

View 3 Replies View Related

Ubuntu :: Cannot Exit TTY Even With Ctrl+Alt+F7 On 10.10

Nov 29, 2010

Here I was, having problems with the resolution then I stopped the X server as was instructed at the tutorial. I followed it all then rebooted. But I found that even after reboot, I'm still stuck with TTY. I clicked Ctrl Alt F7 but still it's a terminal and it did not return to the GUI or the normal desktop. What will I do to exit it? It's a good thing I have windows vista along with it or else I'll now have a computer that I can't use outside the terminal.

As nothingspecial said, I should place the link of the tutorial I was following: [URL]

View 4 Replies View Related

Ubuntu :: Vlc(1.1.7) Is Crashing On Exit?

Mar 3, 2011

i have upgraded vlc 1.1.4 to 1.1.7....but im having a problem regarding the 1.1.7 version. the vlc(1.1.7) is crashing on exit.

View 1 Replies View Related

Fedora :: Use F9 And Want Exit From X Server?

Aug 3, 2010

I use fedora 9 and want exit from x server. when i use init command,show me error.for use init command in fedora 9 what work?

View 4 Replies View Related

Hardware :: USB Drive Does Not Exit?

Jan 20, 2011

I have a (Verbatim, if it matters) USB drive which previously worked with Linux just fine.However, since then I have formatted my drive, and it currently has no partitions on it. I would like to not use a cd to test out Salix, and to use Unetbootin with my USB to install Salix. However, when I plug in my USB it does not mount. Running sudo fdisk -l only gives my hard drive, and neither Gparted or Unetbootin can find it. I'm currently running Xubuntu 9.10, if it matters.

View 9 Replies View Related

General :: My Script Won't Exit ?

Feb 11, 2011

When I run my script(attachment) and I use an option(-l -u -r) that requires an argument, it should exit if the argument isn't supplied, but it doesn't. How do I arrange this?

View 1 Replies View Related

Red Hat :: Su Hangs On Exit After Inactivity

Mar 25, 2010

We have two types of servers RHEL5 and RHEL4 as well as Fedora 11 desktops.

After a period of inactivity, trying to exit from "su - <username>" causes the system to hang for about 10 minutes. It takes that long before the prompt comes back. Here are a few items that noticed as I have tried to trouble shoot this problem. The prompt always comes back if you wait long enough It only happens on RHEL 5. RHEL4 and Fedora 11 are unaffected It does not appear to matter what other software is running. Some boxes have databases, others do not It happens to boxes in run level 3 as well as boxes in run level 5 It does not matter if logging in from the console (tty) or from ssh (pts). Both types of logins produce the same result.

It does not matter if the account is an LDAP or a local account. It takes between 30 min and 1 hour of inactivity before the problem occurs Other sessions on the box are completely unaffected. Once hung, I can still log in with a different session without a problem top shows no load while session is hung there are no messages in /var/log/messages, /var/log/secure, /var/log/audit/audit.log or in dmesg if a session is killed, finger shows that it is still logged in a putty log shows that the server is still sending "keep alives" to putty while the session is hung Only su is affected. There is no problem logging out of the box from the initial login account. what I can try in order to trouble shoot this?

View 2 Replies View Related







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