<?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:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:wfw="http://wellformedweb.org/CommentAPI/">
<channel>
<title>拾光 - 小威博客</title>
<link>https://www.ishiguang.cn/author/30/</link>
<atom:link href="https://www.ishiguang.cn/feed/author/30/" rel="self" type="application/rss+xml" />
<language>zh-CN</language>
<description>小威博客</description>
<lastBuildDate>Tue, 07 Mar 2023 17:16:00 +0800</lastBuildDate>
<pubDate>Tue, 07 Mar 2023 17:16:00 +0800</pubDate>
<item>
<title>Linux自启动脚本编写</title>
<link>https://www.ishiguang.cn/17863.html</link>
<guid>https://www.ishiguang.cn/17863.html</guid>
<pubDate>Tue, 07 Mar 2023 17:16:00 +0800</pubDate>
<dc:creator>小威博客</dc:creator>
<description><![CDATA[本文章向大家介绍Linux里编写shell脚本实现开机自动启动1.连接上SSH终端，使用vim在/etc/init.d/文件夹里面创建一个名为start.sh的脚本文件vim /etc/init...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<blockquote>本文章向大家介绍<a href="https://www.xiaoweio.com/534.html">Linux</a>里编写<a href="https://www.xiaoweio.com/534.html">shell脚本</a>实现开机自动启动</blockquote><p>1.连接上SSH终端，使用<code>vim</code>在<code>/etc/init.d/</code>文件夹里面创建一个名为<code>start.sh</code>的脚本文件</p><pre><code>vim /etc/init.d/start.sh</code></pre><p>2.编写名为<code>start.sh</code>脚本内容</p><pre><code> #!/bin/bash

### BEGIN INIT INFO
# Provides:     start
# Required-Start:  $remote_fs $syslog
# Required-Stop:   $remote_fs $syslog
# Default-Start:   2 3 4 5
# Default-Stop:   0 1 6
# Short-Description: start test
# Description:    start test
### END INIT INFO

#此处编写脚本内容
cd /var/local/
nohup java -jar -Xms512M  -Xmx1024M jenkins.war --httpPort=8080 &gt; jenkins.log 2&gt;&amp;1 &amp;

exit 0</code></pre><p>3.给文件增加权限</p><pre><code>chmod +755 /etc/init.d/start.sh</code></pre><p>4.设置开机自启动</p><pre><code>sudo update-rc.d /etc/init.d/start.sh defaults</code></pre><p>5.重启服务器</p><pre><code>reboot</code></pre><p>6.查看进程</p><pre><code>ps -ef |grep jenkns</code></pre><p>完成OK</p><p><a href="https://www.xiaoweio.com/534.html">文章来源于：小威博客</a></p>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://www.ishiguang.cn/17863.html#comments</comments>
<wfw:commentRss>https://www.ishiguang.cn/feed/author/30/</wfw:commentRss>
</item>
</channel>
</rss>