Solved

Linux script to restart process running out of inittab

Posted on 2006-07-13
6
2,070 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now