Sample Header Ad - 728x90

Why the key After performing automount?

0 votes
1 answer
41 views
I want to make an automatic backup to a flash drive after auto-mounting it. To do this, I wrote in /etc/fstab... UUID=0698-A3CF /flash vfat noauto,nofail,x-systemd.automount,x-systemd.idle-timeout=15,x-systemd.device-timeout=15 And in /etc/systemd/system/ I created the my_backup.service unit. I filled it out according to these instructions . [Unit] Description=My backup script trigger Requires=flash.automount After=flash.automount [Service] ExecStart=/myfolder/python_backup.py [Install] WantedBy=flash.automount The Python script works great if I run it separately and almost perfectly if I run it by mounting a flash drive. Almost, except... actually copying the necessary files. The log says “No /flash device”. In addition, by commenting out the functions for working with files, using a delay in the Python script and the *ls /flash* command, I found out that the flash drive is not mounted until the script is completed to the end. But the unit says “After”! Is it possible to rewrite the unit so that the Python script starts executing after mounting the flash drive?
Asked by Arseniy (101 rep)
Oct 31, 2024, 03:45 PM
Last activity: Nov 1, 2024, 08:22 AM