[systemd-devel] Quick ? about ExecStartPre and Restart
Jan Alexander Steffens
jan.steffens at gmail.com
Thu Jul 4 01:28:21 PDT 2013
On Thu, Jul 4, 2013 at 10:17 AM, Paul D. DeRocco <pderocco at ix.netcom.com> wrote:
>> You don't need to copy it to somewhere else. You can replace an
>> executable without the running process being disturbed, by deleting
>> the file and creating (or moving) a new one in its place. Most tools
>> (like "cp") will do this when they overwrite a file. Then simply
>> restart the service (or have it exec() itself), and the new version
>> will be running.
>> The old version of the executable will continue to exist—even though
>> it has no file name—until nothing uses it anymore.
> Is that true on all filesystems? This is a FAT16 volume on a flash drive in
> an embedded system. It's also possible that the power might get yanked while
> it's in this state, leaving an orphan file. Finally, since it will be
> updated via a Samba file share, I don't know what sort of command will be
> used to change it; it might be an overwrite plus lengthen or truncate
Yes, I believe it's true on all file systems. I tested again with FAT16.
However, I was mistaken about "cp" doing a delete-and-replace by
default, because I forgot I was using "cp --reflink=auto" on a btrfs
volume. Without --reflink, I get an ETXTBSY when trying to copy over
an in-use executable.
"cp -f" works on both filesystems.
Even if Samba doesn't cooperate, doing a manual delete before copying
the new executable should work.
More information about the systemd-devel