automatically restart scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting automatically restart scripts
# 1  
Old 05-18-2010
automatically restart scripts

I am new to AIX shell scripting, please help......

I want to write a automatically restart script for one of my application. For example, the application name: ABC (you can see its ID from ps -ef | grep ABC). It can be started by ABC.sh file but it has to be stopped by using "ps -ef | grep ABC" and "kill" it.

Now I want to automatically restart ABC every 1 hour. AIX version 5.2. K shell.

Can anyone help me?

Thanks a lot~~~
# 2  
Old 05-19-2010
To have scripts executed periodically you can use cron which is described in depth here: https://www.unix.com/answers-frequent...n-crontab.html

When you got the PID you can hand it over to kill with the command xargs for example. Best write your script so that it is able to accept parameters like [start|stop|restart], ie. check $1 with a case/esac statement. This will make it more versatile.
# 3  
Old 05-20-2010
Quote:
Originally Posted by zaxxon
To have scripts executed periodically you can use cron which is described in depth here: https://www.unix.com/answers-frequent...n-crontab.html

When you got the PID you can hand it over to kill with the command xargs for example. Best write your script so that it is able to accept parameters like [start|stop|restart], ie. check $1 with a case/esac statement. This will make it more versatile.

Thanks! I am really new to Shell scripting, is it possible to have you to show me an example? Appreciated~~
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Automatically determining directory path for scripts and programs

I have some C++ code in the following directory structure /home/chrisd/tatsh/trunk/hstmy/ ├── baseLib ├── bin │ ├── awk │ ├── bash │ ├── diag │ ├── ksh │ │ └── TAG201011 │ ├── old │ ├── perl │ ├── prog │ ├── py │ └── tcsh ├── docs ├── fortran ├── others... (0 Replies)
Discussion started by: kristinu
0 Replies

2. HP-UX

Unix server restart automatically

We have HP K class unix server, It's automatically restart the server. (10 Replies)
Discussion started by: ganesh24pal
10 Replies

3. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

4. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

5. UNIX for Dummies Questions & Answers

Automatically Running Scripts

Can someone advise me how to get started automatically running scripts? I believe it has something to do with cron? (4 Replies)
Discussion started by: jeffreydavisjr
4 Replies

6. Shell Programming and Scripting

How can I make a program start up automatically after the computer restart/startup?

hi all How can I make a program start up automatically after the computer restart/startup in fedora? something like: ... Establish a shell then run some of command code. Thanks for Help!! (1 Reply)
Discussion started by: munna_dude
1 Replies

7. Shell Programming and Scripting

need help to write script to check the process health and automatically restart it

I am working on a project, which need to constantly watch the process, and check its status, if it was dead, it should be restart automatically. Please kindly refer me to URL which teach how to write this kind of script, or service. Thanks. (1 Reply)
Discussion started by: dragondad
1 Replies

8. Shell Programming and Scripting

Running shell scripts automatically without using Batch or at commands

I have been trying to run a unix script which contains many sql statements.I need to run this script every monday morning. I tried to run on command prompt, it works fine. But while I run it via batch or at command., it returns with library module could not be loaded (libcompat.1.o could not be... (3 Replies)
Discussion started by: ritzwan0
3 Replies

9. Shell Programming and Scripting

Scripts for calculating size and remaining space of a directory automatically.

I would like to create a script for calculating size and remaining space of a directory automatically every 24 hours, then send an email to report to the admin. * POSIX and PERL are preferred. Can anyone help, please? (1 Reply)
Discussion started by: leonall
1 Replies

10. UNIX for Dummies Questions & Answers

How to run three scripts one after another automatically???

Hi !! How do u run three scripts one after another automatically using crontab command at some specified regular interval. Say i have three scripts A,B,C and i want to run the three scripts A followed by B followed by C. REQUIRE HELP URGENTLY Thanks in advance Arunava . (3 Replies)
Discussion started by: arunava_maity
3 Replies
Login or Register to Ask a Question