Sponsored Content
Top Forums Shell Programming and Scripting Exception-handling in Shell programs Post 302228675 by chaitu_inmage on Monday 25th of August 2008 07:52:22 AM
Old 08-25-2008
Question

Hi blowtorch,

No, I wasn't planning on putting detailed error checks in each of the scripts...they are too long (5000+ lines) and doing that that would take me forever. I am looking more from a less-involved solution. Do you think it's possible actually? Something like - (I am vague I know but it's the best I can do!) -

1. Start a guarded environment at the beginning of each script (guarded as in - each command is executed and if it succeeds, alright; otherwise, break the whole program right there).

2. Execute each command in the script (without explicitly coding for error-checking, i.e.)

3. Run an event like trap in case of failure, and fire an email.

What do you say...?
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

exception handling

Does exception handling exist in any UNIX enviornment? I develop on Windows MSVC++ land and need to port to UNIX. (1 Reply)
Discussion started by: RichardS
1 Replies

2. Programming

Linux g++ 2.95.3 exception handling

Anybody happen to be familiar with any deficiencies with g++ 2.95.3 regarding exception handling, specifically in multi-threaded / multi-module (shared library) based applications? I'm seeing behavior where thrown exceptions are not caught, but basically ignored causing the application to... (0 Replies)
Discussion started by: earl
0 Replies

3. Shell Programming and Scripting

Gen. Question - Script calls multiple programs - Return Code Handling?

General Question: If a script calls multiple external programs (external to the script, but still on unix), where do the return codes go? Let's say one of external programs fails, does the entire script fail and send a non-zero return code to the job scheduling software, or is the return code sent... (1 Reply)
Discussion started by: jnanasakti
1 Replies

4. Linux

Handling "command not found" exception

hello friends, I am given a project to handle the command not found exception.I am using RED HAT 9. Generally, when we press a wrong command in the terminal: example :- " $cet " in place of " $cat ". Then we get this exception. But I need to give the output as the combinations that are possible... (5 Replies)
Discussion started by: nsharath
5 Replies

5. Shell Programming and Scripting

Exception Handling

Hi, I have written a script to load csv files into a mysql database, however, i would like for the shell script to exit in the event of an error (missing file, load error etc.) - currently if an error is encountered the next statement is processed - This is how i am loading the csv scripts ... (5 Replies)
Discussion started by: bertpereira
5 Replies

6. Programming

Advanced Exception Handling in C++

Hi Friend, Could you please provide me with some tutorial for Advanced Exception handling in C++, mainly set_terminate() and set_unexpected() functions? Please find the details below: OS: Unix Compiler: gcc. Thanks. :) Awesome001 (0 Replies)
Discussion started by: awesome001
0 Replies

7. Shell Programming and Scripting

Exception handling

Sometimes when I try to use curl to upload to an ftp server, I get the message: $curl -T file.wmv ftp.eu.filesonic.com --user user:password curl: (8) Got a 421 ftp-server response when 220 was expected How do I get the script to try again if I get the message curl: (8)? (2 Replies)
Discussion started by: locoroco
2 Replies

8. Programming

Exception Handling C++

Hello All, I have a question ....which I am totally confused about! If I have a fxn foo in a program which returns a logical value. But it has a posssiblity to throw some exception. Now my exception handler returns a value as a string stating why the exception occured. But my... (1 Reply)
Discussion started by: mind@work
1 Replies

9. UNIX for Dummies Questions & Answers

Difference between inbuilt suid programs and user defined root suid programs under bash shell?

Hey guys, Suppose i run passwd via bash shell. It is a suid program, which temporarily runs as root(owner) and modifies the user entries. However, when i write a C file and give 4755 permission and root ownership to the 'a.out' file , it doesn't run as root in bash shell. I verified this by... (2 Replies)
Discussion started by: syncmaster
2 Replies
S390_GUARDED_STORAGE(2) 					System Calls Manual					   S390_GUARDED_STORAGE(2)

NAME
s390_guarded_storage - operations with z/Architecture guarded storage facility SYNOPSIS
#include <asm/guarded_storage.h> int s390_guarded_storage(int command, struct gs_cb *gs_cb); DESCRIPTION
The s390_guarded_storage() system call enables the use of the Guarded Storage Facility (a z/Architecture-specific feature) for user-space processes. The guarded storage facility is a hardware feature that allows marking up to 64 memory regions (as of z14) as guarded; reading a pointer with a newly introduced "Load Guarded" (LGG) or "Load Logical and Shift Guarded" (LLGFSG) instructions will cause a range check on the loaded value and invoke a (previously set up) user-space handler if one of the guarded regions is affected. The command argument indicates which function to perform. The following commands are supported: GS_ENABLE Enable the guarded storage facility for the calling task. The initial content of the guarded storage control block will be all zeros. After enablement, user-space code can use the "Load Guarded Storage Controls" (LGSC) instruction (or the load_gs_cb() func- tion wrapper provided in the asm/guarded_storage.h header) to load an arbitrary control block. While a task is enabled, the kernel will save and restore the calling content of the guarded storage registers on context switch. GS_DISABLE Disables the use of the guarded storage facility for the calling task. The kernel will cease to save and restore the content of the guarded storage registers, the task-specific content of these registers is lost. GS_SET_BC_CB Set a broadcast guarded storage control block to the one provided in the gs_cb argument. This is called per thread and associates a specific guarded storage control block with the calling task. This control block will be used in the broadcast command GS_BROAD- CAST. GS_CLEAR_BC_CB Clears the broadcast guarded storage control block. The guarded storage control block will no longer have the association estab- lished by the GS_SET_BC_CB command. GS_BROADCAST Sends a broadcast to all thread siblings of the calling task. Every sibling that has established a broadcast guarded storage con- trol block will load this control block and will be enabled for guarded storage. The broadcast guarded storage control block is consumed; a second broadcast without a refresh of the stored control block with GS_SET_BC_CB will not have any effect. The gs_cb argument specifies the address of a guarded storage control block structure and is currently used only by the GS_SET_BC_CB com- mand; all other aforementioned commands ignore this argument. RETURN VALUE
On success, the return value of s390_guarded_storage() is 0. On error, -1 is returned, and errno is set appropriately. ERRORS
EFAULT command was GS_SET_BC_CB and the copying of the guarded storage control block structure pointed by the gs_cb argument has failed. EINVAL The value provided in the command argument was not valid. ENOMEM command was one of GS_ENABLE or GS_SET_BC_CB, and the allocation of a new guarded storage control block has failed. EOPNOTSUPP The guarded storage facility is not supported by the hardware. VERSIONS
This system call is available since Linux 4.12. CONFORMING TO
This Linux-specific system call is available only on the s390 architecture. The guarded storage facility is available beginning with System z14. NOTES
Glibc does not provide a wrapper for this system call, use syscall(2) to call it. The description of the guarded storage facility along with related instructions and Guarded Storage Control Block and Guarded Storage Event Parameter List structure layouts is available in "z/Architecture Principles of Operations" beginning from the twelfth edition. The gs_cb structure has a field gsepla (Guarded Storage Event Parameter List Address), which is a user-space pointer to a Guarded Storage Event Parameter List structure (that contains the address of the aforementioned event handler in the gseha field), and its layout is avail- able as a gs_epl structure type definition in the asm/guarded_storage.h header. SEE ALSO
syscall(2) Linux Programmer's Manual 2019-03-06 S390_GUARDED_STORAGE(2)
All times are GMT -4. The time now is 05:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy