![Linux 使文件在服务内部可执行](https://linux22.com/image/768677/Linux%20%E4%BD%BF%E6%96%87%E4%BB%B6%E5%9C%A8%E6%9C%8D%E5%8A%A1%E5%86%85%E9%83%A8%E5%8F%AF%E6%89%A7%E8%A1%8C.png)
我确实有如下服务:
[Unit]
Description=API environment service
[Service]
WorkingDirectory=/var/www/api
ExecStart=/var/www/api/api
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnet-example
User=apache
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
服务正常,但每次我通过 ftp 将新文件复制到该文件夹时,我都需要运行sudo chmod +x /var/www/api/api
以使该文件可执行,然后执行sudo systemctl restart api.service
我的问题是,是否可以以某种方式在此服务顶部添加行,以使此文件可执行,如果不是,那么我只需要运行重新启动命令?