rc.local
脚本是一个ubuntu开机后会自动执行的脚本,我们可以在该脚本内添加命令行指令。该脚本位于/etc/路径下,需要root权限才能修改。
sudo vi /etc/rc.local
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. exit 0
注意:
一定要将命令添加在 exit 0之前
1,新建个脚本文件new_service.sh
#!/bin/bash # command content exit 0
2,设置权限
sudo chmod 755 new_service.sh
3,把脚本放置到启动目录下
sudo mv new_service.sh /etc/init.d/
4,将脚本添加到启动脚本 执行如下指令,在这里90表明一个优先级,越高表示执行的越晚
cd /etc/init.d/ sudo update-rc.d new_service.sh defaults 90
sudo update-rc.d -f new_service.sh remove
stat -c "%a %n" file , 755, 644
ModuleNotFoundError: No module named 'MySQLdb', ...
Ubuntu18.04下使用pyenv安装python报错:BUILD FAILED (Ubun ...
dell提供了工具远程查看服务器硬件状态,可以修改硬件的参数,可以远程连接过去直接修改,就不需要 ...
启动报undefined symbol: EVP_CIPHER_CTX_cleanup错误。op ...
ubuntu开启crontab日志记录及解决No MTA installed, discardi ...
暂时还没有评论,第一个来评论吧!