联博(326681.com)_Centos7建立开机自启动服务
发表时间:2020-12-25 浏览量:6
Centos7建立开机自启动服务
方式一:在系统上建立systemctl服务,通过systemctl status | start | restart | disable | enable autoRun.service方式自启服务
1、在/etc/systemd/system下建立autoRun.service文件
2、编辑autoRun.service文件
/etc/systemd/system/autoRun.service
[root@bogon system]# cat auto_run_script.service
[Unit]
Description=Run a Custom Script at Startup
After=default.target
[Service]
ExecStart=/opt/project/autoRunScript.sh
[Install]
WantedBy=default.target
[root@bogon system]#
3、重新加载配置文件
systemctl daemon-reload
systemctl enable autoRun.service
方式二:使用crontab特殊计划任务
,,www.326681.com采用以太坊区块链高度哈希值作为统计数据,联博以太坊统计数据开源、公平、无任何作弊可能性。联博统计免费提供API接口,支持多语言接入。
crontab -e
@reboot /opt/project/autoRun.sh
特殊计划任务写法弥补
string meaning
------ -------
@reboot Run once, at startup.
@yearly Run once a year, "0 0 1 1 *".
@annually (same as @yearly)
@monthly Run once a month, "0 0 1 * *".
@weekly Run once a week, "0 0 * * 0".
@daily Run once a day, "0 0 * * *".
@midnight (same as @daily)
@hourly Run once an hour, "0 * * * *".
0
珍藏