<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000'><font face="arial, helvetica, sans-serif"><span style="font-size: 12pt;">James' script is a good example. The basic idea is that you need a script that takes a parameter "start" to start the service and "stop" to stop it. You usually want a "status" and "restart" to tell you if it's up and restart it. There's often a "condrestart" or I think they're moving to "try-restart" that only restarts if the service is already running. You can add your own if there are some specific things you need--like a database might include an "init" for creating a blank default database (like Postgresql does or used to do). If you call the script with no params, or bad params, it's customary to print a usage message.</span></font><br><br><font face="arial, helvetica, sans-serif"><span style="font-size: 12pt;">A lot of service binaries don't provide a way to stop themselves, so James' script uses a common method of creating a PID file with the process ID, and using that to kill the process on a stop. From a quick Googling, it looks like your service doesn't want to be killed, and provides a command to stop itself. That's fine--just replace the stop logic in the script with your own stop command, such as:</span></font><div><p style="color: rgb(0, 0, 0); font-family: 'Helvetica Neue', Helvetica, Verdana, Arial, sans-serif; font-size: 14px; margin-top: 16px; margin-bottom: 16px; line-height: 1.6; padding: 0px; background-color: rgb(255, 255, 255);"><code style="font-family: 'Courier New', Courier; font-stretch: normal; font-size: 9pt; line-height: 14.3999996185303px; background: rgb(224, 224, 224);">lmutil lmdown -q -c license_file_name</code></p><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;">The PID file may be useful for implementing the "status" unless lmutil has that function too, that you can just call. Also, you might follow the above command with a kill in your script if the above doesn't work for some reason, but then you're just getting fancy!</div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;"><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;">The only other thing you probably need is some specially formatted comments. They are used by chkconfig and related commands for adding the service and making sure it gets started and stopped in the right spot. Here is a doc with some more info on the comment format.</div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html</font></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;"><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;">Scott</div><br><hr id="zwchr" style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;"><div style="color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-size: 12pt; font-weight: normal; font-style: normal; text-decoration: none;"><b>From: </b>"Todor Fassl" &lt;fassl.tod@gmail.com&gt;<br><b>To: </b>"Atlanta Linux Enthusiasts" &lt;ale@ale.org&gt;<br><b>Sent: </b>Tuesday, February 17, 2015 11:13:00 AM<br><b>Subject: </b>[ale] creating an init.d script<br><br>My department runs a FlexLM license server for 2 mathematical programs, <br>maple and matlab. I want to write some init.d scripts to restart the <br>license server instances if we reboot the license server. Right now, I <br>have to login and type the command. I can easily put it in a script but <br>I want to do it right.<br><br>I googled for examples but they all seem so complicated. I tried copying <br>an existing script and modifying it (apprort) but after spending, I <br>dunno, 10 minutes or so modifying it, I found it wasn't suitable as an <br>example.<br><br>What's a good generic init.d script to start with? Any good tutorials <br>you are aware of? I don't want to spend all day learning how to write <br>lsb scripts. An hour or 2 maybe but not all day. If I can't learn how to <br>do it right in an hour or so, I'm just going to quick-and-dirty it.<br><br>_______________________________________________<br>Ale mailing list<br>Ale@ale.org<br>http://mail.ale.org/mailman/listinfo/ale<br>See JOBS, ANNOUNCE and SCHOOLS lists at<br>http://mail.ale.org/mailman/listinfo<br></div><br></div></div></body></html>