Linux 如何配置开机自动运行脚本
适用于使用 SysV init 的系统
注:以下方法适用于使用 SysV init 系统的 Linux 发行版(如 Ubuntu 18.04 及更新版本,或 Debian)。对于使用 Systemd 的发行版(如 Ubuntu 18.04 及更新版本),请使用 systemctl
方法来管理启动服务。
假如我们需要开机自动执行的脚本是 xxx.sh
。首先在 /etc/init.d
目录下创建一个用于启动的脚本,例如名为 autorun.sh
:
sudo nano /etc/init.d/autorun.sh
在其中添加你需要开机自动执行的脚本:
autorun.sh
#!/bin/bash
/path/to/xxx.sh # 修改为具体路径
将 autorun.sh
脚本添加到系统的启动服务中:
sudo update-rc.d autorun.sh defaults
将 autorun.sh
脚本设置为开机启动:
sudo update-rc.d autorun.sh enable
这样,当重新启动后,autorun.sh
脚本将会自动运行。
适用于使用 Systemd 的系统
如果你的 Linux 发行版使用 Systemd 作为启动管理器(例如 Ubuntu 18.04 及更高版本),你可以使用 systemctl
命令来设置自动启动。
假如我们需要开机自动执行的脚本是 xxx.sh
。首先创建一个描述你想自启动服务的 Unit 文件,比如 autorun.service
:
sudo nano /etc/systemd/system/autorun.service
在 Unit 文件中,定义你的服务的配置。以下是一个示例:
autorun.service
[Unit]
Description=My Service
After=network.target
[Service]
ExecStart=/path/to/xxx.sh
[Install]
WantedBy=default.target
其中的参数分别为:
Description
:描述你的服务。After
:指定你的服务在哪些其他服务之后启动。例如,network.target
表示在网络服务启动后才启动你的服务。ExecStart
:指定你要执行的脚本或命令的路径。WantedBy
:指定你的服务应该被启动的目标(target)。default.target
表示在默认目标启动时启动你的服务。
保存并关闭文件,运行以下命令以重新加载 systemd 配置:
sudo systemctl daemon-reload
使用以下命令使能你的服务:
sudo systemctl enable autorun.service
最后,使用以下命令启动:
sudo systemctl start autorun.service
现在,你的服务已经设置为在系统启动时自动运行。你可以重新启动系统来验证服务是否正常启动。
Your blog engrosses me from start to finish. I can’t simply leave without absorbing your whole post.
You are my breathing in, I possess few blogs and sometimes run out from to brand : (.
I admire your ability to break down complex ideas into accessible parts. Kudos!
Your communication style eloquently captures your authentic self, making readers feel connected and heard.
This is amongst the few anabolic research review (Bart) steroids that may really burn fats immediately.
All who supplement will find a Parabolan cycle significantly enhances the metabolism.
This will enable the person to achieve less body fats in the low
season and burn more physique fats at a higher rate during phases of chopping.
Dianabol (Dbol) can additionally be a powerful plateau breaker, and when used in this part
of a cycle, it’s going to assist you to push previous
limitations and gradual or halt positive aspects so that you don’t succumb to a plateau.
A reduction in subcutaneous physique fat is one other positive review we will typically see.
This is more of a bonus end result with Dianabol as it is not a true fat-burning
steroid. Dianabol can burn fat and build muscle if solely maintenance-level energy are consumed.
If you would possibly be eating in a calorie surplus for bulking,
you likely won’t discover much or any fats loss with this steroid.
So, together with water weight, which is especially noticeable firstly of the cycle, don’t be afraid to aim
for a 30 lbs weight acquire from a normal Dbol cycle.
As Soon As the water weight is gone or decreased
significantly, increased muscle definition will turn into
distinguished, and your complete muscle mass gain can easily be within the 15-20lbs vary – typically more.
We strongly advise bodybuilders to avoid utilizing trenbolone as a
result of doubtlessly deadly results it might possibly trigger.
We have found that the risk of atherosclerosis and left
ventricular hypertrophy significantly will increase with trenbolone cycles.
Our patients have reported speedy fats loss whereas
also constructing noticeable amounts of muscle and strength on trenbolone/Winstrol cycles.
Blood pressure will need to be monitored very frequently on this cycle, as it’s likely to spike
to very excessive levels. To counteract this and shield the center as much as potential, customers ought to carry out cardio.
This is probably not ideal for bodybuilders who’re bulking and don’t like running or biking;
however, it’s important for cardiovascular protection.
Some girls can use this steroid at very low doses, but
there are undoubtedly different way more appropriate compounds for females that don’t cause such pronounced androgenic results.
Although a mighty AAS, newbie steroid customers can still
normally tolerate it nicely at lower doses, and 15mg can provide glorious outcomes (despite what some people
may say). If you’ve got high-quality Dbol, a 15mg
daily dose will give a unbelievable introduction to this steroid with manageable unwanted effects.
If you might be in search of a specific SARM,
I’d say 10-20mg/day Cardarine for eight weeks.
One Other option is to do an Anavar cycle at 10mg/day (split Anavar into two
doses every day at 5mg/each, as quickly as with breakfast and once more earlier than bedtime) for
8 weeks. With both choices, get off as a lot fat as you can naturally,
hit the cardio hard, and then use one of them. Slicing and contest prep cycles can profit from either Proviron or S-4, however if
you would like to improve energy and muscle gains, the S-4 is the higher choice.
If Clomid is combined with other PCT medicine, your dosage will
probably be lower than the examples beneath, as it’s primarily based
on utilizing Clomid as the solely real PCT compound.
Like men, women will see slow and regular gains
with EQ, together with energy and muscle positive aspects.
Women can probably construct more muscle as they are going to be more delicate to the anabolic effects of Equipoise, and some wonderful vascularity can be
achieved if they are comparatively low in physique fats.
In the above instance, should you want just 10mg, you’d solely require 0.5ml from that bottle.
The advantage of liquid SARMs is that they make measuring these smaller quantities
simpler, so your dosage ought to be very accurate. A SARM strength cycle may help you restore a
few of that power, primarily making it an anti-aging
cycle in some methods. Positive Aspects of 10 to 15 pounds
are greater than achievable with this powerful stack, with some guys
reaching 20 pounds with the right coaching.
You should also feel much less basic muscle and joint pain and have an general improved recovery.
A newer SERM that increasingly more steroid
customers are turning to and using as a alternative for Clomid.
You can consider blasting and cruising as the opposite of post-cycle therapy.
Blasting and cruising are about sustaining a substitute
testosterone dose (TRT) between cycles.
Administered via injection or tablet, this cycle usually lasts 8-12 weeks, with a 3-4 week break between cycles.
It’s also utilized in short-term rehabilitation earlier than and after
surgical procedure. This is why it’s crucial to work on restoring the natural hormone balance after
using AAS compounds. T3 could be paired with some anabolic steroids as a fat-burning agent
in a chopping cycle, with the steroids preventing any potential
catabolism or muscle tissue loss. The full potential fat loss benefits of T3 will
only be realized in case your cutting diet is operating
at a calorie deficit and your workouts are appropriate.
EQ offers glorious power and lean mass advantages
for the bodybuilder, though mass features could be gradual and never at the
stage of more highly effective bulking steroids.
A attainable discount in urge for food from Anavar will help together with your weight-reduction plan.
You can anticipate glorious synergy between these two compounds to get you shifting a few of the
more stubborn fats. Begin PCT 14 days after the
cycle if you’ve used test enanthate, then 20 days of Clomid at 50mg day by day, and it helps to add half mg every day of
Arimidex with it. Steroid stacks mix two or extra compounds so you presumably can combine their benefits and achieve larger results than using just one
compound alone. Newbie stacks could be easy, while superior customers can easily combine three
or more compounds in a cycle.