在Ubuntu中设置进程自动启动有多种方法,以下是常见的几种:
/etc/systemd/system/服务名.service,添加[Unit]、[Service]、[Install]等配置段,指定描述、启动命令、用户等信息。然后执行sudo systemctl daemon-reload、sudo systemctl enable 服务名.service和sudo systemctl start 服务名.service,分别完成重新加载配置、设置开机自启和立即启动。crontab -e,在文件末尾添加@reboot /path/to/your/application,保存退出即可。