Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Perl Scripts as init.d (service RH)

Status
Not open for further replies.

jimsngc

Technical User
Mar 8, 2002
3
US
Hi,

I am trying to run a perl script as an init.d process (So I can auto-restart/kill etc) but am having problems.

Firstly, it seems to not want to include the normal perl modules and fails - runs just fine if I call the script manually?

Secondly, I am not sure if the pid will write correctly without me scripting this into the actual perl script?

Any ideas?

Thanks,

Jim
 
Pardon my question - but - why would you want to be killing and restarting processes during the system start-up (init)?

Regarding the perl not running - perhaps the path to the perl libs is not set so perl, although being executed, cannot find the path/list of its dependencies/modules?

You might want to examine the path when the script does run and then set that path just prior to running the script from where you want.

Please post your solution for us to read.

Bob
 
Hi,

Thanks for the tips - I will try these when I get to work in the morning.

I'm running on RedHat so the init.d become a service for me.
The reason I need to restart a service is simple - another service is logging and when it restarts the perl script 'looses' the log file it is following - to be able to restart everything in one go is my aim.... Hope that makes sense - but I'm not the best at describing things...

Jim
 
Why do you want something so convoluted in your boot
script tree?
There are good reasons for running boot scripts in
the shell: the interpreter is guaranteed no matter what the fs state.
You are asking for trouble.
 
Ok - so it appears I am doing something dumb then? ;) That does not suprise me...

Can you suggest a better way of doing this to avoid problems down the line. I think the simplest way of putting my problem is that I want to be able to track the PID of a Perl script so I can restart it at set times using cron. If there is a better way please point me in that direction...

Tell me if you need any specific info and I will post it here.

Thanks for the ongoing help folks.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top