Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Linux script to restart process running out of inittab

Posted on 2006-07-13
6
Medium Priority
?
2,077 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
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 24

Accepted Solution

by:
slyong earned 500 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month12 days, 14 hours left to enroll

971 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