自定义服务,重启系统后服务不能正常启动(未达到系统重启后自动拉起服务的目的)。查看系统日志发现服务启动时报错。信息如下:
[ 7.148737] systemd[1]: Configuration file /lib/systemd/system.conf.d/00-systemd-conf.conf is marked executable. Please remove executable permission bits. Proceeding anyway.
[ 7.162894] systemd[1]: Configuration file /lib/systemd/system.conf.d/00-systemd-conf.conf is marked world-writable. Please remove world writability permission bits. Proceeding anyway.
[ 7.189869] systemd[1]: Configuration file /lib/systemd/system.conf.d/01-watchdog.conf is marked executable. Please remove executable permission bits. Proceeding anyway.
[ 7.203661] systemd[1]: Configuration file /lib/systemd/system.conf.d/01-watchdog.conf is marked world-writable. Please remove world writability permission bits. Proceeding anyway.
大意为:配置文件被标记为全局可写,无论如何请移除全局可写权限。
查看我的服务配置文件权限为666,systemd可能担心服务配置被其他用户恶意篡改,所以限制配置文件权限不能是全局可写。修改服务配置文件权限为644后,重启系统,服务正常启动。