在Ubuntu中,要配置systemd服务自启动,可以按照以下步骤操作:
.service
为扩展名,比如my_service.service
。[Unit]
Description=My Service
After=network.target
[Service]
Type=simple
ExecStart=/path/to/your/service
Restart=always
User=your_username
[Install]
WantedBy=multi-user.target
/etc/systemd/system/
目录下。sudo systemctl daemon-reload
sudo systemctl enable my_service.service
sudo systemctl start my_service.service
这样,你的服务就会在系统启动时自动启动。你也可以通过sudo systemctl status my_service.service
命令查看服务的状态。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: ubuntu上thrift的安全性如何