<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Linux: How to write a System V init script to start, stop, and restart my own application or service</title> <atom:link href="http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Shalom Crown</title><link>http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-178280</link> <dc:creator>Shalom Crown</dc:creator> <pubDate>Mon, 09 Jan 2012 18:19:46 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-178280</guid> <description>I haven&#039;t used mysql for a few years, but it should have a System V service script of its own, or use upstart or whatever replaces System V services on your machine.
You have to specify what operating system, version etc.
Note also that the above script probably won&#039;t work on Debian based systems as there is no /etc/init.d/functions - and you have to do all those things the slow way.
Both Fedora and Ubuntu have moved on to Upstart (and I believe Fedora have something even newer), so the System V service scripts become an emulation.
With System V you would use a command like:
service restart mysql
With Upstart this becomes something like:
restart mysql
To do this daily at 01:00 you would have to edit your root user&#039;s crontab, and place the commands there - like
sudo crontab -e
..and place a line in the file like:
00    01    *    *    *    restart mysql
But then I have questions for you (to think about):
How long have you been using Unix/Linux?
If this is a production server - do you need expert advice, rather than doing it on your own?
Why is there a need to restart a database server every night?
Especially the last question. I can&#039;t imagine that recent releases of MySQL have memory leaks or other problems. I leave database servers running for months at a time with no problems.
Maybe the problem is rather that you have long running queries that you don&#039;t control?</description> <content:encoded><![CDATA[<p>I haven&#8217;t used mysql for a few years, but it should have a System V service script of its own, or use upstart or whatever replaces System V services on your machine.</p><p>You have to specify what operating system, version etc.</p><p>Note also that the above script probably won&#8217;t work on Debian based systems as there is no /etc/init.d/functions &#8211; and you have to do all those things the slow way.</p><p>Both Fedora and Ubuntu have moved on to Upstart (and I believe Fedora have something even newer), so the System V service scripts become an emulation.</p><p>With System V you would use a command like:<br
/> service restart mysql</p><p>With Upstart this becomes something like:<br
/> restart mysql</p><p>To do this daily at 01:00 you would have to edit your root user&#8217;s crontab, and place the commands there &#8211; like</p><p>sudo crontab -e</p><p>..and place a line in the file like:</p><p>00    01    *    *    *    restart mysql</p><p>But then I have questions for you (to think about):<br
/> How long have you been using Unix/Linux?<br
/> If this is a production server &#8211; do you need expert advice, rather than doing it on your own?<br
/> Why is there a need to restart a database server every night?</p><p>Especially the last question. I can&#8217;t imagine that recent releases of MySQL have memory leaks or other problems. I leave database servers running for months at a time with no problems.<br
/> Maybe the problem is rather that you have long running queries that you don&#8217;t control?</p> ]]></content:encoded> </item> <item><title>By: akram</title><link>http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-178207</link> <dc:creator>akram</dc:creator> <pubDate>Sun, 08 Jan 2012 14:29:31 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-178207</guid> <description>I will use this script to restart mysql service ,  so I will change the following :
/path/to/FOO &amp;  --&gt; to be  /retrovue/home/mysql
retrovue ( user )
touch /var/lock/subsys/FOO  --&gt; to be touch /var/lock/subsys/mysql
killproc FOO ----&gt; to be killproc mysql
rm -f /var/lock/subsys/FOO --&gt; rm -f /var/lock/subsys/mysql
is it correct ?
How I can make this Script run daily at 01:00 AM
I wait your reply ASAP</description> <content:encoded><![CDATA[<p>I will use this script to restart mysql service ,  so I will change the following :<br
/> /path/to/FOO &amp;  &#8211;&gt; to be  /retrovue/home/mysql<br
/> retrovue ( user )<br
/> touch /var/lock/subsys/FOO  &#8211;&gt; to be touch /var/lock/subsys/mysql<br
/> killproc FOO &#8212;-&gt; to be killproc mysql<br
/> rm -f /var/lock/subsys/FOO &#8211;&gt; rm -f /var/lock/subsys/mysql</p><p>is it correct ?</p><p>How I can make this Script run daily at 01:00 AM</p><p>I wait your reply ASAP</p> ]]></content:encoded> </item> <item><title>By: Shalom Crown</title><link>http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-160514</link> <dc:creator>Shalom Crown</dc:creator> <pubDate>Thu, 28 Oct 2010 21:31:18 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-160514</guid> <description>I would be interested to know if and how the game for the blind was written.
For those who are used to J2EE, Apache modules, .NET and all those other technologies, something that does netcat &#124; sed ... &#124; netcat might be a refreshing change.</description> <content:encoded><![CDATA[<p>I would be interested to know if and how the game for the blind was written.</p><p>For those who are used to J2EE, Apache modules, .NET and all those other technologies, something that does netcat | sed &#8230; | netcat might be a refreshing change.</p> ]]></content:encoded> </item> <item><title>By: Ron</title><link>http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-140755</link> <dc:creator>Ron</dc:creator> <pubDate>Fri, 10 Aug 2007 22:16:59 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-140755</guid> <description>Inquisitive,
If you cut and past this example, it may have inserted the wrong &quot; characters. Simply replace the double quotes in your copy and it should work.</description> <content:encoded><![CDATA[<p>Inquisitive,</p><p>If you cut and past this example, it may have inserted the wrong &#8221; characters. Simply replace the double quotes in your copy and it should work.</p> ]]></content:encoded> </item> <item><title>By: inquisitive</title><link>http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-122513</link> <dc:creator>inquisitive</dc:creator> <pubDate>Tue, 24 Apr 2007 20:48:13 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-122513</guid> <description>When I use the script for a test daemon, get the following error for line:45 which the echo statement below. Am I missing something?
echo $”Usage: $0 {start&#124;stop&#124;restart&#124;reload&#124;status}”
./testd: line 45: restart: command not found
--cmd and --run are incompatible with --string or --name
./testd: line 45: reload: command not found
./testd: line 45: status}”: command not found</description> <content:encoded><![CDATA[<p>When I use the script for a test daemon, get the following error for line:45 which the echo statement below. Am I missing something?</p><p>echo $”Usage: $0 {start|stop|restart|reload|status}”</p><p>./testd: line 45: restart: command not found<br
/> &#8211;cmd and &#8211;run are incompatible with &#8211;string or &#8211;name<br
/> ./testd: line 45: reload: command not found<br
/> ./testd: line 45: status}”: command not found</p> ]]></content:encoded> </item> <item><title>By: ratana</title><link>http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-117940</link> <dc:creator>ratana</dc:creator> <pubDate>Thu, 19 Apr 2007 17:03:27 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-117940</guid> <description>Yes, I agree with comment#4, How we program FOO is much more important than a bash script.</description> <content:encoded><![CDATA[<p>Yes, I agree with comment#4, How we program FOO is much more important than a bash script.</p> ]]></content:encoded> </item> <item><title>By: Saleem Hardy</title><link>http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-91133</link> <dc:creator>Saleem Hardy</dc:creator> <pubDate>Fri, 16 Mar 2007 22:36:51 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-91133</guid> <description>Is a daemon simply a program that I write in &#039;bash&#039; and is always running on my host&#039;s server and it simply calls my pearl script that does all the &#039;ios::socket&#039; listening? I&#039;m not sure what a daemon is and how to create one. Please explain or give me a link to a text file explaining the daemon file. P.S. Should this be a new topic? If so, where should I post it. I would need to post the original message.</description> <content:encoded><![CDATA[<p>Is a daemon simply a program that I write in &#8216;bash&#8217; and is always running on my host&#8217;s server and it simply calls my pearl script that does all the &#8216;ios::socket&#8217; listening? I&#8217;m not sure what a daemon is and how to create one. Please explain or give me a link to a text file explaining the daemon file. P.S. Should this be a new topic? If so, where should I post it. I would need to post the original message.</p> ]]></content:encoded> </item> <item><title>By: nixcraft</title><link>http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-90981</link> <dc:creator>nixcraft</dc:creator> <pubDate>Fri, 16 Mar 2007 19:20:38 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-90981</guid> <description>This is script is an example to start or stop daemon or service. You are coding in C/C++ and you need to write daemon using same language until and unless you are writing API for perl or php.</description> <content:encoded><![CDATA[<p>This is script is an example to start or stop daemon or service. You are coding in C/C++ and you need to write daemon using same language until and unless you are writing API for perl or php.</p> ]]></content:encoded> </item> <item><title>By: Saleem Hardy</title><link>http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-90306</link> <dc:creator>Saleem Hardy</dc:creator> <pubDate>Fri, 16 Mar 2007 03:52:32 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-90306</guid> <description>Hello, I have a problem and would like some real help. I believe it deals with the topic just discussed. At this point, I’m not sure of the questions I’m supposed to be asking. Here’s my problem: I’m about to start programming some “multiplayer” games for the blind. The games will be text-based games (no heavy load graphics). I am going to write my game interface using my ‘visual studio 2005’ software in c++. All the players will have a copy of my game interface on their computers. The game interface will send each player’s move or ‘turn decision’ to a ‘constantly’ running script, which will be ‘listening’ for clients on the Internet. The script will then send the ‘move’ to all the other players of the game so everyone has the same instance of the game at the same time. I have never done this before. I am just extrapolating on what I like to call the ‘logical progression flow’. I have a domain (htpad.com) with the host4profit website hosting service. They have two files in my root directory: ‘.bash_profile’ and ‘.bashrc’. I know these two files have something to do with the ‘bash’ shell. I was also told I would need to create a ‘deamon bash script’ if I wanted a script that would continuously ‘listen’ on the Internet for clients in order to process their moves. My question is this: Am I on the write track, and how do I create a ‘safe’ deamon script that will not make my host provider nervous?</description> <content:encoded><![CDATA[<p>Hello, I have a problem and would like some real help. I believe it deals with the topic just discussed. At this point, I’m not sure of the questions I’m supposed to be asking. Here’s my problem: I’m about to start programming some “multiplayer” games for the blind. The games will be text-based games (no heavy load graphics). I am going to write my game interface using my ‘visual studio 2005’ software in c++. All the players will have a copy of my game interface on their computers. The game interface will send each player’s move or ‘turn decision’ to a ‘constantly’ running script, which will be ‘listening’ for clients on the Internet. The script will then send the ‘move’ to all the other players of the game so everyone has the same instance of the game at the same time. I have never done this before. I am just extrapolating on what I like to call the ‘logical progression flow’. I have a domain (htpad.com) with the host4profit website hosting service. They have two files in my root directory: ‘.bash_profile’ and ‘.bashrc’. I know these two files have something to do with the ‘bash’ shell. I was also told I would need to create a ‘deamon bash script’ if I wanted a script that would continuously ‘listen’ on the Internet for clients in order to process their moves. My question is this: Am I on the write track, and how do I create a ‘safe’ deamon script that will not make my host provider nervous?</p> ]]></content:encoded> </item> <item><title>By: Sean</title><link>http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-10132</link> <dc:creator>Sean</dc:creator> <pubDate>Wed, 20 Sep 2006 12:15:24 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html#comment-10132</guid> <description>Don&#039;t forget to highlight the description and chkconfig comments at the top, they&#039;re what the chkconfig utility uses to figure out what run levels to start/stop the script in.  It&#039;s not necessary for the script to work, but if the comments are in there they should be right!
Sean</description> <content:encoded><![CDATA[<p>Don&#8217;t forget to highlight the description and chkconfig comments at the top, they&#8217;re what the chkconfig utility uses to figure out what run levels to start/stop the script in.  It&#8217;s not necessary for the script to work, but if the comments are in there they should be right!</p><p>Sean</p> ]]></content:encoded> </item> </channel> </rss>
