From 34f7c9e71531fbf7d9773d0dd7f7562ffab4989a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 3 Jan 2016 13:42:19 +0100 Subject: add restart-radharc script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- extra/restart-radharc | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 extra/restart-radharc diff --git a/extra/restart-radharc b/extra/restart-radharc new file mode 100755 index 0000000..49b40f2 --- /dev/null +++ b/extra/restart-radharc @@ -0,0 +1,55 @@ +#!/bin/sh + +# Copyright © 2016 Mattias Andrée +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# DEPENDENCIES: findutils, coreutils, sed, util-linux, linux, sh + +# Frequent international traveller? Set up cron to run this every +# now and then. It will restart all your instances of radharc, and +# if you have a custom script in $PATH named radharc (as your should +# have) that figures out your location and starts radharc, radharc +# will br aware of your no location. + + +# Close all file descriptors (except stderr,) so that radharc does not inherity any. +for fd in $(ls -1 /dev/fd/); do + if [ ! "$fd" = 2 ]; then + eval "exec ${fd}<&-"; + fi +done + +# Restart all instances of radharc. +for pid in pgrep -x radharc; do + # Open environ and cmdline and be sure that they we successfully opened. + exec 3/dev/null 2>/dev/null &) +done + -- cgit v1.2.3-70-g09d2