我应该在我的单元文件中放入什么以确保我的服务在通过 ntp 设置时间后启动?
我有一个带有小型 python 脚本的树莓派,可以将数据记录到 SQL 数据库中。由于 rpi 没有 RTC 电池,在启动时或没有互联网连接时,时间和数据都是错误的。为避免数据库中的时间戳产生误导,脚本应在获取正确时间后运行。
到目前为止我的单位文件:
[Unit]
Description=desc
Requires=mysql.service
After=syslog.target mysql.service
[Service]
Type=simple
ExecStart= /usr/bin/python3 /etc/script/script.py
SyslogIdentifier=test
StandardOutput=null
StandardError=syslog
Restart=always
RestartSec=5
User=pi
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
我应该如何修改我的单元文件?
我的系统版本是:
#> systemctl --version
systemd 232
Run Code Online (Sandbox Code Playgroud)