Ubuntu-在启动时使用"sudo"运行命令; [英] Ubuntu - Run command on start-up with "sudo"

查看:507
本文介绍了Ubuntu-在启动时使用"sudo"运行命令;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Ubuntu启动时(在任何人登录之前)运行sudo命令:

I would like to run a sudo command when Ubuntu starts up (before anyone logs in):

sudo searchd

我该怎么做?

推荐答案

您可以在启动结束时执行的/etc/rc.local脚本中添加命令.

You can add the command in the /etc/rc.local script that is executed at the end of startup.

exit 0之前写命令. exit 0之后写的任何内容都将永远不会执行.

Write the command before exit 0. Anything written after exit 0 will never be executed.

这篇关于Ubuntu-在启动时使用"sudo"运行命令;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆