ON_EXIT(3) Linux Programmer's Manual ON_EXIT(3)NAME
on_exit - register a function to be called at normal program termination.
SYNOPSIS
#include <stdlib.h>
int on_exit(void (*function)(int , void *), void *arg);
DESCRIPTION
The on_exit() function registers the given function to be called at normal program termination, whether via exit(3) or via return from the
program's main. The function is passed the argument to exit(3) and the arg argument from on_exit().
RETURN VALUE
The on_exit() function returns the value 0 if successful; otherwise it returns a non-zero value.
CONFORMING TO
This function comes from SunOS, but is also present in libc4, libc5 and glibc.
SEE ALSO atexit(3), exit(3)GNU 1993-04-02 ON_EXIT(3)
Check Out this Related Man Page
ON_EXIT(3) Linux Programmer's Manual ON_EXIT(3)NAME
on_exit - register a function to be called at normal process termination
SYNOPSIS
#include <stdlib.h>
int on_exit(void (*function)(int , void *), void *arg);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
on_exit(): _BSD_SOURCE || _SVID_SOURCE
DESCRIPTION
The on_exit() function registers the given function to be called at normal process termination, whether via exit(3) or via return from the
program's main(). The function is passed the status argument given to the last call to exit(3) and the arg argument from on_exit().
The same function may be registered multiple times: it is called once for each registration.
When a child process is created via fork(2), it inherits copies of its parent's registrations. Upon a successful call to one of the
exec(3) functions, all registrations are removed.
RETURN VALUE
The on_exit() function returns the value 0 if successful; otherwise it returns a nonzero value.
CONFORMING TO
This function comes from SunOS 4, but is also present in libc4, libc5 and glibc. It no longer occurs in Solaris (SunOS 5). Avoid this
function, and use the standard atexit(3) instead.
SEE ALSO _exit(2), atexit(3), exit(3)COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 2008-12-05 ON_EXIT(3)
Hi
I believe there is a method to remove all temporary files when a KSH script terminates (either expectedly or unexpectedly).
I think is some sort of subroutine you can create that runs when the script exits. Can anyone help me with this please?
Many thanks
Helen :confused: (2 Replies)
Hi all,
I start my application from a shell command-line.
When I exit my application, it kills the shell that its returning too.
Worse yet, since I have init respawning the shell all those subsequent
shells get killed automatically...so I get output like the following
(the >> is the prompt for... (2 Replies)
Whenever I quit out of reading a man page, it clears the screen.
I do not like this behavior, as I'd like to keep part of the man page on the screen while I type out a command.
How do I stop this behavior? (6 Replies)
Hi,
I am doing a sftp from solaris 2.8 box to windows XP box. I am able to transfer the files successfully from the windows box to Solaris box (that is only I need).
Problem arises when I try to exit/quit from the sftp session. sftp gets hung and I have to kill the telnet session by closing... (1 Reply)
Hi,
I have a problem with '.zlogout' not being run on Solaris 10.
Here's whats happening.
I remotely log in from a PC running Cygwin/X using a local xterm window and ssh to start a remote 'zsh' shell, version 4.2.5, on a Solaris 10 server.
The Server has KDE installed but as a Window... (0 Replies)
Hi all,
does anyone know an easy to read manual for newbies introducing X11 - more specifically how to open windows, resizing them, etc...?
I namely installed FreeBSD 7.0 on an old HP omnibook xe4100 notebook because it's less demanding in resources. So far so good, everything went smooth... (0 Replies)
Hi all,
I am using the trap command in my script, and I want it to trap the signal based on the exit code the script returns.
can anybody tell me how can I use "if loop" for "trap" command.
I want to print
"terminated by user" if signal is SIGINT or 2
"failure" if signal is not 2 and not 0... (1 Reply)
Hello all,
One of the application we port to Aix from linux Segmentation faults when it exits. Here is part of backtrace of SEGV:
(dbx) where
splay(??, ??, ??) at
free_y(??, ??) at
free_common(??) at
....
exit(??) at
...
Application seem to perform everything expected well and... (1 Reply)
Hi,
I have 2 problems with a simple C++ app which i feel may be related.
1/ my app throws a Segmentaion Fault when my code exists from main(). I have stripped it to it's simplest form with no code in main and it still generates a segmentation fault.
I'm not sure what is causing this,... (9 Replies)
hi
while executing the following script, my terminal window is getting closed if I enter a invalid option. I want the script should go back the the command prompt. how to do achive it. i execute the script as . ./test
#! /usr/bin/ksh
Printf " Type of Installer : \n\t\t 1. Whole Build... (3 Replies)
Hi,
Any workaround for this issue, since i am using one script to execute the remote script for several remote server, everything works fine except some of the servers process are hangs even its completed.
---Please help me to resolve this issue----
Script details are here..
for... (2 Replies)
Guys,
I am writing a script that executes a series of commands with a function like:
_Command "ps -ef | grep java"
_Command "vmstat"
_Command "llll"
Even if one of these commands fail, my script should exit with non-zero code i.e 16.
If all commands are successful, my script should exit... (7 Replies)
Hi,
I am writing a script in which I am using an IF-Else statement.
Code sample:
# Check for the product.
If (test "$3" = "Pet") Then
Product_Code="PI"
elif (test "$3" = "Breakdown") Then
Product_Code="RI"
elif (test "$3" = "Travel") Then
Product_Code="TI"
... (2 Replies)
Hi All,
Requirement: The below script should automatically exit at 6pm everyday without manually killing the script
Tried running with the below shell script but found the script was still running when the time was 6:15pm. The script did not exit the while loop at 6pm
The script runs... (6 Replies)
Dear all,
We have a service that we start up remotely with rsh but unfortunately, the rsh never returns to the calling server. This seems to be because the processes of the service we've just started hold the port open.RBATTE1 @ /home/RBATTE1>netstat -na|grep 49.51
tcp4 0 0 ... (1 Reply)