Re: Safely replacing /etc/s6-rc/compiled

2015-11-12 Thread Laurent Bercot

On 12/11/2015 18:59, Jan Bramkamp wrote:

Is there a way to update /etc/s6-rc/compiled without risking a broken
system if the power fails midway through the update? The best I can
come up with is to use a symlink to a uniquely named compiled
directory and a recompile wrapper


 That is exactly the way it's intended to be used.
 /etc/s6-rc/compiled should at all times be a symlink to the real
compiled database, and the link should be updated atomically.

 I did not provide binaries or scripts to do that around s6-rc-update,
because the exact details of the operations are policy; I expected
admins to be able to use the mechanism responsibly - and I was right,
because you are doing the right thing! :)

--
 Laurent


Safely replacing /etc/s6-rc/compiled

2015-11-12 Thread Jan Bramkamp
Is there a way to update /etc/s6-rc/compiled without risking a broken 
system if the power fails midway through the update?
The best I can come up with is to use a symlink to a uniquely named 
compiled directory and a recompile wrapper along those lines:


cd /etc/s6-rc
s6-rc-compile .compiled-$SUFFIX source
s6-rc-update $PWD/.compiled-$SUFFIX $* # TODO: avoid $*
ln -s .compiled-$SUFFIX .compiled-${SUFFIX}.link
mv .compiled-${SUFFIX}.link compiled
# TODO: cleanup old .compiled-* dirs
fsync compiled .


Re: Safely replacing /etc/s6-rc/compiled

2015-11-12 Thread Steve Litt
On Thu, 12 Nov 2015 18:59:30 +0100
Jan Bramkamp  wrote:

> Is there a way to update /etc/s6-rc/compiled without risking a broken 
> system if the power fails midway through the update?

Couldn't you just back up the file(s), and if something goes wrong,
boot back in with System Rescue CD and copy the backups back to
original?
 
SteveT

Steve Litt 
November 2015 featured book: Troubleshooting Techniques
 of the Successful Technologist
http://www.troubleshooters.com/techniques