After modifying systemctl myService.service file, when command "sudo systemctl daemon-reload" is executed remotely via SSH through a bash sh script:
- The myService.service file is modified correctly in remote server
- But nothing happens with daemon reloading, changes are not reloaded in the remote server system.
Sample of bash sh script section:
ssh -i "/myssh.key" myuser@host "sudo bash 'echo -e \"ExecStart=/mydir/run-service.sh\" >> /etc/systemd/system/myService.service'"ssh -i "/myssh.key" myuser@host "sudo systemctl daemon-reload"
Service file is modified correctly on remote server, but it seems daemon reload command has no effect on remote server.
However, after executing the above script, invoking "sudo systemctl daemon-reload" manually via ssh terminal session, changes are reloaded properly.
Putting the two commands separated by ; in the same ssh call don't solve the problem.
Server: Ubuntu 22.04.4Remote client (running the sh script): Windows WSL2Containers: no