Sponsored Content
Top Forums Shell Programming and Scripting hi all please help me in this issue. Post 302340712 by bhas85 on Tuesday 4th of August 2009 09:07:10 AM
Old 08-04-2009
hi john

Its working .Thank you very much for ur valuable reply.
Regards,
Vijay

---------- Post updated at 08:07 AM ---------- Previous update was at 08:05 AM ----------

Quote:
Originally Posted by johnbach
Code:
while [ 1 ]
do
   #run your process in background 
   process argument &
   wait $!
   sleep 1
echo 'Restarting'
done


Hi,
Slight modification in my requirement, I want in the code that if the process is killed or aborted when the process is running, It should restart at that time also.
The signals are as below:

switch(signum){
case SIGHUP: return "JVM hangup";
break;
case SIGINT: return "JVM interrupted";
break;
case SIGQUIT: return "JVM Quit";
break;
case SIGILL: return "Illegal instruction";
break;
case SIGABRT: return "JVM aborted";
break;
case SIGFPE: return "Floating point exception";
break;
case SIGKILL: return "JVM killed";
break;
case SIGBUS: return "Bus error";
break;
case SIGSEGV: return "Segmentation violation";
break;
case SIGSYS: return "Bad argument to system call";
break;
case SIGTERM: return "Software termination signal from kill";
break;
case SIGCHLD: return "Child process terminated or stopped";
break;
default: return "JVM abnormally terminated";
break;
}
I dont know how to trap these signals in the script.
Please let me solve in this issue.

Thanks in advance.
Vijay,

Last edited by bhas85; 08-04-2009 at 10:12 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

ps issue

HI All, Suddenly don't know what happened to redhat linux 7.2 any program start then itsn't listing while using ps -ef ex: ./xyz this xyz program pid not showing in ps-ef Pls let me know what is the reason for the same. Thanks a lot in advance Bache (7 Replies)
Discussion started by: bache_gowda
7 Replies

2. Shell Programming and Scripting

Unix Arithmatic operation issue , datatype issue

Hi, I have a shell scripting. This will take 7 digit number in each line and add 7 digit number with next subsequent lines ( normal addition ). Eg: 0000001 0000220 0001235 0000022 0000023 ........... ......... ........ Like this i am having around 1500000 records. After adding... (23 Replies)
Discussion started by: thambi
23 Replies

3. UNIX for Dummies Questions & Answers

ISSUE and ISSUE.NET files

In LINUX(CentOS, RedHat) is there a way to have the banner statement appear before the logon instead of after the logon? In UNIX and Windows the banner appears before a person actually logs on, what I'm seeing in LINUX is that it appears after the login(ftp, telnet, SSH). Thanks (0 Replies)
Discussion started by: ejjones
0 Replies

4. Solaris

IP issue

hi , I have a Solaris server which is part of a domain. The IP for this Solaris box is allocated dyanamically by a DHCP. Everytime the solaris box is restarted the IP gets changed. Being an admin what should i do to find the new ip of the Solaris server sitting at my location? Till now i get... (2 Replies)
Discussion started by: BalajiUthira
2 Replies

5. Shell Programming and Scripting

CP Issue

I want to copy large amount of files aproximately more than 20,000 files from one file system to another file system, but it gives me error like: #cd /opt/appserver/images #cp * /opt/appserver02/public/images Argument list is too long Also above mention error appear again when i run: ... (1 Reply)
Discussion started by: telnor
1 Replies

6. Shell Programming and Scripting

Need assistance with a file issue and a terminal issue

Hello everyone, I'm in need of some assistance. I'm currently enrolled in an introductory UNIX shell programming course and, well halfway through the semester, we are receiving our first actual assignment. I've somewhat realized now that I've fallen behind, and I'm working to get caught up, but for... (1 Reply)
Discussion started by: MrMagoo22
1 Replies

7. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

8. Shell Programming and Scripting

What could be the issue ?

Hi, when i am trying below script assume that below values are taken in code #!/bin/ksh if then echo usage: aNlist.sh QMGR NAME MQREQ fi NL=`echo 'dis qmgr'|runmqsc $1|grep REPOSNL|sed 's/.*REPOSNL\(.*\).*/\1/' |cut -d'(' -f2|cut -d')' -f1` echo 'define nl('$NL_$2')... (25 Replies)
Discussion started by: darling
25 Replies

9. Shell Programming and Scripting

Issue with wc -c and wc -m

Hi All, I have a small queries to get the character count i tried with wc -c and wc -m but its not returend current result For eg: wc -c wc -m echo "Name" | wc -c result: 5 but actually it should returned 4 Help me on this to ge the correct one. Thanks! ----------... (4 Replies)
Discussion started by: siva.pitchai
4 Replies
GETSUBOPT(3)						   BSD Library Functions Manual 					      GETSUBOPT(3)

NAME
getsubopt -- get sub options from an argument LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> extern char *suboptarg; int getsubopt(char **optionp, char * const *tokens, char **valuep); DESCRIPTION
The getsubopt() function parses a string containing tokens delimited by one or more tab, space or comma (',') characters. It is intended for use in parsing groups of option arguments provided as part of a utility command line. The argument optionp is a pointer to a pointer to the string. The argument tokens is a pointer to a NULL-terminated array of pointers to strings. The getsubopt() function returns the zero-based offset of the pointer in the tokens array referencing a string which matches the first token in the string, or, -1 if the string contains no tokens or tokens does not contain a matching string. If the token is of the form ``name=value'', the location referenced by valuep will be set to point to the start of the ``value'' portion of the token. On return from getsubopt(), optionp will be set to point to the start of the next token in the string, or the null at the end of the string if no more tokens are present. The external variable suboptarg will be set to point to the start of the current token, or NULL if no tokens were present. The argument valuep will be set to point to the ``value'' portion of the token, or NULL if no ``value'' portion was present. EXAMPLES
char *tokens[] = { #define ONE 0 "one", #define TWO 1 "two", NULL }; ... extern char *optarg, *suboptarg; char *options, *value; while ((ch = getopt(argc, argv, "ab:")) != -1) { switch(ch) { case 'a': /* process ``a'' option */ break; case 'b': options = optarg; while (*options) { switch(getsubopt(&options, tokens, &value)) { case ONE: /* process ``one'' sub option */ break; case TWO: /* process ``two'' sub option */ if (!value) error("no value for two"); i = atoi(value); break; case -1: if (suboptarg) error("illegal sub option %s", suboptarg); else error("missing sub option"); break; } } break; } } SEE ALSO
getopt(3), strsep(3) HISTORY
The getsubopt() function first appeared in 4.4BSD. BSD
December 25, 2011 BSD
All times are GMT -4. The time now is 05:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy