Skip to content

使用 crontab 设置开机自启任务

crontab 是一个定时任务调度工具,可以方便地设置开机运行的任务。

步骤:

  1. 打开终端,编辑当前用户的 crontab 文件
shell
$ crontab -e
  1. 添加一行以设置开机自启任务,例如:
shell
$ @reboot /path/to/your/script.sh
  1. 保存并退出
shell
:wq