[systemd-devel] Quick ? about ExecStartPre and Restart
Paul D. DeRocco
pderocco at ix.netcom.com
Thu Jul 4 01:17:39 PDT 2013
> From: Jan Alexander Steffens [mailto:jan.steffens at gmail.com]
>
> On Thu, Jul 4, 2013 at 2:04 AM, Paul D. DeRocco
> <pderocco at ix.netcom.com> wrote:
> > 1) I want my service executable to be copied from flash to
> > RAM disk, and
> > then executed from there, so that the original can be
> > updated while the copy is running.
>
> 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
operation.
--
Ciao, Paul D. DeRocco
Paul mailto:pderocco at ix.netcom.com
More information about the systemd-devel
mailing list