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!

Using perl in /etc/init.d ?

Status
Not open for further replies.

forrie

MIS
Mar 6, 2009
91
US
I'm not able to get a native perl script to run under RHEL 5.x in the /etc/init.d section.

Specifically, we're trying to get certain information logged when the system shuts down.

(yes, it's checked in with chkconfig)

What I suspect I must do is wrap the init.d script in /bin/sh then have it call the bash script during shutdown.

I'm just trying to confirm this limitation... can someone comment?


Thanks.
 
As Annihilannic suggested, I ran my script with debugging and found a very subtle variable that the scripting subsystem depends upon...

Code:
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/mytest
return $RETVAL

the last line, "return", is what was missing. Because I didn't have that return variable, it was just skipping over it.

That's "thus far" -- I will do some more testing, but I think this works. So you need to have the subsys lock and the RETVAL from that check included in the init.d script for it to work properly (through shutdown).

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top