/usr/bin/scriptingcontrol is in rsplib-services 3.0.1-1ubuntu3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | #!/bin/sh
# $Id: scriptingcontrol 2608 2011-11-23 07:52:38Z dreibh $
# --------------------------------------------------------------------------
#
# //===// //===== //===// // // //===//
# // // // // // // // // //
# //===// //===== //===// // // //===<<
# // \\ // // // // // //
# // \\ =====// // //===== // //===// Version II
#
# ------------- An Efficient RSerPool Prototype Implementation -------------
#
# Copyright (C) 2002-2012 by Thomas Dreibholz
#
# 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 <http://www.gnu.org/licenses/>.
#
# Contact: dreibh@iem.uni-due.de
# ====== Preparation ========================================================
if [ $# -lt 1 ] ; then
echo >2 "Usage: scriptingcontrol {[run] [Directory] [Input] [Output] [Status] [Environment]} {[cleanup] [Directory] [PID] {keeptempdirs}}"
exit 1
fi
MODE="$1"
# ====== Work mode ==========================================================
if [ "$MODE" = "run" ] ; then
if [ $# -lt 4 ] ; then
echo >2 "Usage: scriptingcontrol [run] [Directory] [Input] [Output] [Status]"
exit 1
fi
DIRECTORY="$2"
INPUT_NAME="$3"
OUTPUT_NAME="$4"
STATUS_NAME="$5"
ENVIRONMENT_NAME="$6"
# ====== Extract input ===================================================
cd $DIRECTORY || exit 1
# Extract the input file:
# - First, try plain Tar
# - If it does not work, try Tar/GZip
# - If it does not work, try Tar/BZip2
# - If it does not work, return an error
tar xf $INPUT_NAME || tar xzf $INPUT_NAME || tar xjf $INPUT_NAME || exit 1
# ====== Do the actual work ==============================================
chmod 700 ssrun && \
./ssrun $OUTPUT_NAME $ENVIRONMENT_NAME || exit 1
# ====== Clean up directory =================================================
elif [ "$MODE" = "cleanup" ] ; then
if [ $# -lt 3 ] ; then
echo >2 "Usage: scriptingcontrol [cleanup] [Directory] [PID] {keeptempdirs}"
exit 1
fi
DIRECTORY="$2"
PID="$3"
KEEPTEMPDIRS="$4"
# ------ Send SIGKILL to worker process and all of its childs ------------
if [ $PID -ne 0 ] ; then
CHILD_PIDS=""
find_child_pids() {
for pid in `pgrep -P $1` ; do
CHILD_PIDS="$CHILD_PIDS $pid"
find_child_pids $pid
done
}
find_child_pids $PID
echo "Terminating$CHILD_PIDS $PID ..."
kill -KILL $CHILD_PIDS $PID
fi
# ------ Remove temporary directory --------------------------------------
if [ "$KEEPTEMPDIRS" != "keeptempdirs" ] ; then
rm -rf "$DIRECTORY"
fi
# ====== Bad mode ===========================================================
else
echo "ERROR: Bad mode setting $MODE!"
exit 1
fi
exit 0
|