首页 > 系统相关 >ubuntu 开启rc.local

ubuntu 开启rc.local

时间:2023-10-16 17:01:04浏览次数:34  
标签:systemd License service rc etc ubuntu local

1、创建rc.local.service服务的软链接

ln -s /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service
touch /etc/rc.local
chmod +x /etc/rc.local

2、修改  /etc/rc.local

#!/bin/bash
 
#你的命令,不要有死循环或无法退出的程序,不然进不了系统
#mount -t 9p -o trans=virtio hostshare /mnt/share
 
exit 0

3、直接执行生效

/etc/rc.local start

4、rc-local.service 文件内容 

#  SPDX-License-Identifier: LGPL-2.1+
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.local is executable.
[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no

 

标签:systemd,License,service,rc,etc,ubuntu,local
From: https://www.cnblogs.com/wuhg/p/17767755.html

相关文章

  • Codeforces Round 636 (Div. 3) A. Candies
    \(vv\)有\(n\)个糖果,\(vv\)记得这些糖果是按如下方式购买的:第\(i\)天买了\(2^{i-1}x\)个,总共买了\(k\)天,\(k>1\)。但是\(vv\)忘了\(x\)是多少,询问任意一个满足条件的\(x\)。保证给出的\(n\)存在这样一个\(x\)。显然,根据几何或二进制证明,有\(\sum_{......
  • Ubuntu SVN 需要证书及密码验证问题
    问题概览问题一Ubuntu20.04下使用SVN,会报错SVN的证书错误,无论是选择接受t还是永久接受p,下次都会要求再次接受;在kali或者Windows上没有出现该问题。Errorvalidatingservercertificatefor'https://xxx.xxx.xxx.xxx:443':-Thecertificatehasanunknowner......
  • Perceptual Losses 风格迁移论文复现小记
    看了一篇李飞飞组的论文PerceptualLossesforReal-TimeStyleTransferandSuper-Resolution。论文地址为:https://arxiv.org/pdf/1603.08155.pdf))想去找找代码复现一下。原文没有提供代码,就只有找找别人按照论文细节实现的代码。不过但是论文是2016年的,距离现在2023年已经......
  • ubuntu 20.04系统上安装teleport开源堡垒机
    ubuntu20.04安装部署teleport堡垒机简介:Teleport是一款简单易用的开源堡垒机系统,具有小巧、易用的特点,支持RDP/SSH/SFTP/Telnet协议的远程连接和审计管理官方网站地址:https://www.tp4a.com/官方文档地址:https://docs.tp4a.com/官方下载地址:https://www.tp4a.com/downlo......
  • Build ASP.NET Core applications deployed as Linux containers into an AKS/Kuberne
    原文:https://learn.microsoft.com/en-us/dotnet/architecture/containerized-lifecycle/design-develop-containerized-apps/build-aspnet-core-applications-linux-containers-aks-kubernetesAzureKubernetesServices(AKS)isAzure'smanagedKubernetesorchestrat......
  • pytorch的 jit功能不应该叫aot功能吗?
    jit简介pytorch的jit功能是为了生成类似于计算图的功能,能加快模型速度,便于部署,属于是取tensorflow之长补自己之短。jit由来之所以叫jit,是因为他仍然属于实时解释的范畴,但是能预先生成中间量,“审时度势”地实时运行。参考可以看这位帖子:https://zhuanlan.zhihu.com/p/65088592......
  • RuntimeError: Attempting to deserialize object on CUDA device 1 but torch.cuda.d
    问题:服务器上多块卡,使用其中一张训练的模型,在本地预测的时候报错。解决:在torch.load中加入map_location,指定一块卡 ......
  • 禁用Ubuntu Release TLS更新
    在使用ubuntu进行开发,会有如下提示WelcometoUbuntu12.04.5LTS(GNU/Linux3.4.0-030400-generici686)*Documentation:https://help.ubuntu.com/Newrelease'14.04.1LTS'available.Run'do-release-upgrade'toupgradetoit.禁用方法:vim/etc/update-......
  • CodeForces 887E Little Brother
    洛谷传送门CF传送门根据初中数学知识,圆心在\(AB\)线段的中垂线上。又因为给定圆与\(AB\)线段所在直线不交,所以圆心在中垂线的一端极远处完全包含这个给定圆,在另一端极远处与这个给定圆相离。而具体在哪一端只与圆心在\(AB\)的左侧还是右侧有关。因此可以二分找到与给......
  • ubuntu 22.04安装mysql5.7
    ubuntu22.04系统安装mysql5.7一、查看系统默认安装的数据库版本apt-getupdateapt-cachepolicymysql-serverubuntu20.04自带的版本是8.0.34,而我们需要安装mysql5.7的版本就需要换源二、更换apt源1.备份原来的source文件cp/etc/apt/sources.list/etc/apt/sources......