<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>linux Archives - george mastro</title>
	<atom:link href="https://georgemastro.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://georgemastro.com/tag/linux/</link>
	<description>web developer, photographer, filmmaker</description>
	<lastBuildDate>Sat, 25 Oct 2025 20:41:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://georgemastro.com/wp-content/uploads/2016/02/cropped-mastro-avatar-square-32x32.jpg</url>
	<title>linux Archives - george mastro</title>
	<link>https://georgemastro.com/tag/linux/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Replace text in all files in a project &#8211; Linux</title>
		<link>https://georgemastro.com/replace-text-in-all-files-in-a-project-linux/</link>
		
		<dc:creator><![CDATA[mastro]]></dc:creator>
		<pubDate>Wed, 18 Jun 2014 15:16:51 +0000</pubDate>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<guid isPermaLink="false">http://georgemastro.com/?p=38</guid>

					<description><![CDATA[<p>Just run this: grep --include={*.php,*.html,*.htm} -rnl './' -e "text" &#124; xargs -i@ sed -i 's/text/new text/g' @ replacing the extensions you want to be included.</p>
<p>The post <a href="https://georgemastro.com/replace-text-in-all-files-in-a-project-linux/">Replace text in all files in a project &#8211; Linux</a> appeared first on <a href="https://georgemastro.com">george mastro</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Just run this:</p>
<p><code>grep --include={*.php,*.html,*.htm} -rnl './' -e "text" | xargs -i@ sed -i 's/text/new text/g' @</code><br />
replacing the extensions you want to be included.</p>
<p>The post <a href="https://georgemastro.com/replace-text-in-all-files-in-a-project-linux/">Replace text in all files in a project &#8211; Linux</a> appeared first on <a href="https://georgemastro.com">george mastro</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to start ghost on CentOS automatically</title>
		<link>https://georgemastro.com/how-to-start-ghost-on-centos-automatically/</link>
		
		<dc:creator><![CDATA[mastro]]></dc:creator>
		<pubDate>Thu, 29 May 2014 19:12:11 +0000</pubDate>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[ghost]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[script]]></category>
		<guid isPermaLink="false">http://georgemastro.com/?p=5</guid>

					<description><![CDATA[<p>CentOS init script for the ghost blogging platform There are actually 4 ways to automatically start ghost automatically. Some prefer &#8220;forever&#8221;, take a look here http://blog.nodejitsu.com/keep-a-nodejs-server-up-with-forever/ Other prefer &#8220;upstart&#8221;, guide here http://www.howtoinstallghost.com/how-to-start-ghost-as-a-service-on-linux/ Another one is &#8220;pm2&#8221;, http://www.allaboutghost.com/keep-ghost-running-with-pm2/ But I prefer setting up an init script for Linux and in this case CentOS 6. Here is [&#8230;]</p>
<p>The post <a href="https://georgemastro.com/how-to-start-ghost-on-centos-automatically/">How to start ghost on CentOS automatically</a> appeared first on <a href="https://georgemastro.com">george mastro</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>CentOS init script for the ghost blogging platform</p>
<p>There are actually 4 ways to automatically start ghost automatically.</p>
<p>Some prefer &#8220;forever&#8221;, take a look here http://blog.nodejitsu.com/keep-a-nodejs-server-up-with-forever/<span id="more-5"></span></p>
<p>Other prefer &#8220;upstart&#8221;, guide here http://www.howtoinstallghost.com/how-to-start-ghost-as-a-service-on-linux/</p>
<p>Another one is &#8220;pm2&#8221;, http://www.allaboutghost.com/keep-ghost-running-with-pm2/</p>
<p>But I prefer setting up an init script for Linux and in this case CentOS 6.</p>
<p>Here is the Code I&#8217;ve used. You should put it in a new file here: /etc/init.d/ghost<br />
<code><br />
#!/bin/sh<br />
#<br />
# ghost - this script starts the ghost blogging package<br />
#<br />
# chkconfig: - 95 20<br />
# description: ghost is a blogging platform built using javascript \<br />
# and running on nodejs<br />
#</code></p>
<p># Source function library.<br />
. /etc/rc.d/init.d/functions</p>
<p># Source networking configuration.<br />
. /etc/sysconfig/network</p>
<p># Check that networking is up.<br />
[ &#8220;$NETWORKING&#8221; = &#8220;no&#8221; ] &amp;&amp; exit 0</p>
<p>home=&#8221;/var/www/georgemastro.com/web/&#8221;<br />
exec=&#8221;/usr/local/bin/node index.js &gt;&gt; /var/www/georgemastro.com/log/ghost.log &amp;&#8221;<br />
prog=&#8221;ghost&#8221;</p>
<p>[ -e /etc/sysconfig/$prog ] &amp;&amp; . /etc/sysconfig/$prog</p>
<p>lockfile=/var/lock/subsys/$prog</p>
<p>start() {<br />
#[ -x $exec ] || exit 5<br />
echo -n $&#8221;Starting $prog: &#8221;<br />
# if not running, start it up here, usually something like &#8220;daemon $exec&#8221;<br />
export NODE_ENV=production<br />
cd $home<br />
daemon &#8211;user=root $exec<br />
retval=$?<br />
echo<br />
[ $retval -eq 0 ] &amp;&amp; touch $lockfile<br />
return $retval<br />
}</p>
<p>stop() {<br />
echo -n $&#8221;Stopping $prog: &#8221;<br />
# stop it here, often &#8220;killproc $prog&#8221;<br />
pid=`ps -u $prog -fw | grep $prog | grep -v &#8221; grep &#8221; | awk &#8216;{print $2}&#8217;`<br />
kill -9 $pid &gt; /dev/null 2&gt;&amp;1 &amp;&amp; echo_success || echo_failure<br />
retval=$?<br />
echo<br />
[ $retval -eq 0 ] &amp;&amp; rm -f $lockfile<br />
return $retval<br />
}</p>
<p>restart() {<br />
stop<br />
start<br />
}</p>
<p>my_status() {<br />
local base pid lock_file=</p>
<p>base=${1##*/}</p>
<p># get pid<br />
pid=`ps -u $prog -fw | grep $prog | grep -v &#8221; grep &#8221; | awk &#8216;{print $2}&#8217;`</p>
<p>if [ -z &#8220;${lock_file}&#8221; ]; then<br />
lock_file=${base}<br />
fi<br />
# See if we have no PID and /var/lock/subsys/${lock_file} exists<br />
if [[ -z &#8220;$pid&#8221; &amp;&amp; -f /var/lock/subsys/${lock_file} ]]; then<br />
echo $&#8221;${base} dead but subsys locked&#8221;<br />
return 2<br />
fi</p>
<p>if [ -z &#8220;$pid&#8221; ]; then<br />
echo $&#8221;${base} is stopped&#8221;<br />
return 3<br />
fi</p>
<p>if [ -n &#8220;$pid&#8221; ]; then<br />
echo $&#8221;${base} (pid $pid) is running&#8230;&#8221;<br />
return 0<br />
fi</p>
<p>}</p>
<p>rh_status() {<br />
# run checks to determine if the service is running or use generic status<br />
my_status $prog<br />
}</p>
<p>rh_status_q() {<br />
rh_status &gt;/dev/null 2&gt;&amp;1<br />
}</p>
<p>case &#8220;$1&#8243; in<br />
start)<br />
rh_status_q &amp;&amp; exit 0<br />
$1<br />
;;<br />
stop)<br />
rh_status_q || exit 0<br />
$1<br />
;;<br />
restart)<br />
$1<br />
;;<br />
status)<br />
rh_status<br />
;;<br />
*)<br />
echo $&#8221;Usage: $0 {start|stop|restart|status}&#8221;<br />
exit 2<br />
esac<br />
exit $?</p>
<p>Make sure you give the file proper permissions<br />
<code>chmod 755 /etc/init.d/ghost</code></p>
<p>Then the only thing you have to do is type<br />
<code>service ghost start</code></p>
<p>And finally you just have to set this script to run on every reboot of your server.<br />
<code>chkconfig --levels 235 ghost on</code></p>
<p>The post <a href="https://georgemastro.com/how-to-start-ghost-on-centos-automatically/">How to start ghost on CentOS automatically</a> appeared first on <a href="https://georgemastro.com">george mastro</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
