<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">That reminds me of lock file.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">The OP didn’t mention which operating system he is using.&nbsp; If he is using a RedHat based distro (e.g. RHEL, CentOS, Fedora, Scientific) he needs to be sure
 to have logic to create a lock file and remove it.&nbsp; &nbsp;RHEL’s start/stop assumes if there is no lock file that the service is already stopped and won’t do the stop at shutdown (or with “service &lt;script&gt; stop”<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> ale-bounces@ale.org [mailto:ale-bounces@ale.org]
<b>On Behalf Of </b>Scott Plante<br>
<b>Sent:</b> Tuesday, February 17, 2015 12:41 PM<br>
<b>To:</b> Atlanta Linux Enthusiasts<br>
<b>Subject:</b> Re: [ale] creating an init.d script<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">James' script is a good example. The basic idea is that you need a script that takes a parameter &quot;start&quot; to start the service and &quot;stop&quot; to stop it. You usually want a &quot;status&quot;
 and &quot;restart&quot; to tell you if it's up and restart it. There's often a &quot;condrestart&quot; or I think they're moving to &quot;try-restart&quot; 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 &quot;init&quot; 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.<br>
<br>
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:<o:p></o:p></span></p>
<div>
<p style="mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;background:white">
<code><span style="font-size:9.0pt;color:black;background:#E0E0E0">lmutil lmdown -q -c license_file_name</span></code><span style="font-size:10.5pt;font-family:&quot;Helvetica&quot;,&quot;sans-serif&quot;;color:black"><o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">The PID file may be useful for implementing the &quot;status&quot; 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!<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">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.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><a href="http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html</span></a><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Scott<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"><o:p>&nbsp;</o:p></span></p>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">
<hr size="2" width="100%" noshade="" style="color:black" align="center">
</span></div>
<div>
<p class="MsoNormal"><b><span style="font-family:&quot;Helvetica&quot;,&quot;sans-serif&quot;;color:black">From:
</span></b><span style="font-family:&quot;Helvetica&quot;,&quot;sans-serif&quot;;color:black">&quot;Todor Fassl&quot; &lt;</span><a href="mailto:fassl.tod@gmail.com"><span style="font-family:&quot;Helvetica&quot;,&quot;sans-serif&quot;">fassl.tod@gmail.com</span></a><span style="font-family:&quot;Helvetica&quot;,&quot;sans-serif&quot;;color:black">&gt;<br>
<b>To: </b>&quot;Atlanta Linux Enthusiasts&quot; &lt;</span><a href="mailto:ale@ale.org"><span style="font-family:&quot;Helvetica&quot;,&quot;sans-serif&quot;">ale@ale.org</span></a><span style="font-family:&quot;Helvetica&quot;,&quot;sans-serif&quot;;color:black">&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>
</span><a href="mailto:Ale@ale.org"><span style="font-family:&quot;Helvetica&quot;,&quot;sans-serif&quot;">Ale@ale.org</span></a><span style="font-family:&quot;Helvetica&quot;,&quot;sans-serif&quot;;color:black"><br>
</span><a href="http://mail.ale.org/mailman/listinfo/ale"><span style="font-family:&quot;Helvetica&quot;,&quot;sans-serif&quot;">http://mail.ale.org/mailman/listinfo/ale</span></a><span style="font-family:&quot;Helvetica&quot;,&quot;sans-serif&quot;;color:black"><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
</span><a href="http://mail.ale.org/mailman/listinfo"><span style="font-family:&quot;Helvetica&quot;,&quot;sans-serif&quot;">http://mail.ale.org/mailman/listinfo</span></a><span style="font-family:&quot;Helvetica&quot;,&quot;sans-serif&quot;;color:black"><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"><o:p>&nbsp;</o:p></span></p>
</div>
</div>
</div>
</body>
</html>