use of systemd services when user logs out

Asked by geole0

Good morning.

The current context.
   I back up the home data manually. That is, as I think about it.
   The script is based on the RSYNC command.
   To automate it, I thought about using the services offered by systemd.
   I'd say it pretty much works.
              With a timer service that is triggered regularly.
             and with a service that is triggered when the machine stops or goes to sleep.

It's this second part that I don't really like.
In fact, this personal computer is used alternately by several users.
So the script is forced to save all users. Which takes a little time. Well more than if it only saved the last user's data.

I would like to do differently:
saving user data when they log out or change users. Which seems more normal to me.
But I was unable to find examples of service coding launching when the user disconnects or when the user changes.

My idea is to start the backup service for the user who logs out. You also have to figure out how not to block the new connection while the backup is taking place.

The French discussion is available in the forum. https://forum.ubuntu-fr.org/viewtopic.php?id=2083345

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Simone Pelosi (pelpsi) said :
#1

I have moved this question to the Ubuntu answers site.

Can you help with this problem?

Provide an answer of your own, or ask geole0 for more information if necessary.

To post a message you must log in.