瀏覽代碼

Add some scripts as in progress

Samuel W. Flint 2 年之前
父節點
當前提交
31be2b6b1d
共有 3 個文件被更改,包括 55 次插入0 次删除
  1. 35 0
      in-progress/background-job
  2. 17 0
      in-progress/notify-job
  3. 3 0
      in-progress/tel

+ 35 - 0
in-progress/background-job

@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+NAME=""
+COMMAND_FILE=""
+ENV_FILE=""
+MAIL_NOTIFICATION=""
+NOTIFICATION_SCRIPT=""
+PID=$$
+
+USAGE="Usage: `basename $0` [-h] [-n name] [-e env-file] [-m mail-address] [-N notifier]"
+
+while getopts hn:e:m:N: OPT; do
+    case "$OPT" in
+        h)
+            echo $USAGE
+            exit 0
+            ;;
+        n)
+            NAME=$OPTARG
+            ;;
+        e)
+            ENV_FILE=$OPTARG
+            ;;
+        m)
+            MAIL_NOTIFICATION=$OPTARG
+            ;;
+        N)
+            NOTIFICATION_SCRIPT=$OPTARG
+            ;;
+        \?)
+            echo $USAGE >&2
+            exit 1
+            ;;
+    esac
+done

+ 17 - 0
in-progress/notify-job

@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+JOB=$1
+COMMANDFILE=$2
+ADDRESS=$3
+
+mkdir -p "~/jobs/${JOB}"
+
+/bin/sh "$COMMANDFILE" | tee "~/jobs/${JOB}/output"
+
+mail -s "Your Job is Complete" -a "~/jobs/${JOB}/output" "${ADDRESS}" <<EOF
+The output of the command file is attached.
+
+JOB=${JOB}
+COMMANDFILE=${COMMANDFILE}
+ADDRESS=${ADDRESS}
+EOF

+ 3 - 0
in-progress/tel

@@ -0,0 +1,3 @@
+#!/bin/sh
+
+linphone "sip:$1@magnum.axvoice.com"