9
2
I have a Fedora 23 Machine.
I have a directory/file synchronizing bash script that synchronizes my local /home directory to a remote directory (in a NAS machine). I run it manually but I would like to create a systemd service and make it more flexible, since other people use my PC with their own user credentials, I 'd like to know when a user is logged in and start my service afterwards.
Is there something I can do from my service's systemd file or will I have to check that from my code in the script?
I only need to make sure that I have access to environment variables (like $USER) and to run it as a service.
My main source of documentation is this link https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Unit_Files.html
Does
systemctl --user
work on F23? – user1686 – 2016-02-09T08:56:18.973I guess so, It returns a list and a message
76 loaded units listed
. – GeorgeKaf – 2016-02-09T09:27:50.720Here's another approach which might work for you: http://unix.stackexchange.com/a/109270/111707 Write a small Python script which you launch from
– IanB – 2017-03-04T10:38:54.887.bashrc
on login, then it listens for Gnome logout signal and shuts itself down.@IanB Thank you, I will test it. It never hurts to have something like that around. – GeorgeKaf – 2017-03-14T06:19:19.783