On 3/12/2013 5:42 AM, Martin Steigerwald wrote:
> Am Freitag, 8. März 2013 schrieb Stan Hoeppner:
>> If the techs are determined to hard cut power because they don't have
>> the time or the knowledge to do a clean shutdown, it may be well worth
>> your time/effort to write a script and teach the field techs to execute
>> it, before flipping the master switch. Your simple script would run as
>> root, or you'd need to do some sudo foo within, and would contain
>> something like:
>> #! /bin/sh
>> echo 2 > /proc/sys/vm/drop_caches
>> echo "Ready for power down."
> mount -o remount,ro /your/mount/point
> One can at least try. Maybe some "service stop" commands before that.
> But then, if using a script like this, why not just type "halt"?
The real solution to the OP's problem has nothing to do with XFS, buffer
flushing, nor Linux shutdown modes. The problem is power and automation
of cutting power. And the solution is rather simple.
Put a small UPS in the van backing the server, connect USB or serial,
and configure upsmon. When the crews hit the master switch, AC to the
UPS is lost, and upsmon then performs a clean shutdown of the server.
The crews do nothing more than they currently do. And they don't have
to wait on anything. If the previously described "master" switch *is*
currently a UPS, simply install another smaller unit inline to the
server. Disable the audible alarm on the small unit as by default it
will screech continuously while AC input is absent. At the end of the
day they simply flip the switch on this little UPS so it's not running
overnight/weekends (though with no load it probably wouldn't drain the
battery--this just a safety precaution). At the start of the next day,
they flip the master switch, then the little UPS switch.
I've not laid eyes on the vans/power circuits/gear in question so I'm
making educated guesses. There may be even better/easier ways to do it.
But one way or another, a properly configured UPS/upsmon setup is the
way to go, if the desire is to easily control everything with power