You are not logged in.
My situation is as follows:
* asd.service is system service
* psd.service is user mode systemd service
Both do some symbolic link/tmpfs trickery to spped up loading of certain folders in my home dir.
Next I want to make new service which is going to perform home dir backup. And that service conflicts with both of them; Can I somehow stop those services if running, run backup.service and start those services again after finishing?
Offline
Are you really asking just how to stop and start a service?
systemctl stop <whatever>
rsync <whatever-else>
systemctl start <whatever>
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Kinda,
I am asking can I do it within service file or I have to make script for it.
Offline
Ah, sorry that is a good question. I don't know of any way of doing this in the service file itself. I presume your backup service though must call a script, right? I'd just put the stop/start at the top/bottom of that script.
You can use multiple exec lines that are run in order doing basically what was in my last post. But given systemd's goals of doing as much in parallel as possible, I'm not sure if/how you could ensure the proper complete shutdown of asd/psd before the backup command was also exec'ed.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline