Solved

Linux script to restart process running out of inittab

Posted on 2006-07-13
6
2,073 Views
Last Modified: 2008-01-09
Can someone help me with writing a script to restart a process running out of the inittab.
Any links or suggestions would be great.



Thank you.
0
Comment
Question by:cbones
  • 2
  • 2
  • 2
6 Comments
 
LVL 24

Expert Comment

by:slyong
ID: 17105737
Hi cbones,

Could you let us know what is the process that you want to restart and the relevant entry in the inittab?
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 17106196
run the application from inittab as following
c1:2345:respawn:/path/to/application

then just kill the application if You want to restat it (init will respawn it)
killall application
0
 

Author Comment

by:cbones
ID: 17159224
One of our software venders has a java process running in the inittab. They can't seem to figure out why it crashes so often.  The only way to get it running again is to kill the process manually and restart it.  I wanted to have a script run every night to stop the process and then restart it.  This way there would be no issues with the process stopping.

It seems when it is running for a few days it hangs up.  I believe the restart would help stop this issue.


Thanks.

0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 24

Accepted Solution

by:
slyong earned 125 total points
ID: 17159250
use crontab to schedule the restart of the application (shutdown and startup).  Login as the user you can stop and start the application.  Then on the command line type:

$ crontab -e
10 0 * * * /path/to/script/restartscript.sh

The above will run restartscript.sh as 12:10am every night.  In your restartscript.sh you would need to issue the command to kill the process and restart it:

#!/bin/bash
/usr/bin/killall processname
/path/to/applicationstartup

**Note that in the restartscript.sh you have to use the fullpath.

0
 

Author Comment

by:cbones
ID: 17161394
Thank you for all your help.  I am going to give it a shot.


Thank you.
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 17162496
What is has to do with init/inittab?
But I guess it works...
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Debian 3 - initrd rebuild 3 80
Installing rpm without root access 1 58
Prestashop 1.5 Redirect Problem 1 118
Cron jobs 12 136
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question