what about a script that needs input parameters.
Next time if you ask something phrase it like a question. Here's how:
Code:
#!/bin/sh
# Queue capture job using At
progn="capq"; capdir=~/caps; args=("$@"); argn=${#args[@]}
__help() { echo "${progn}: capturename duration at-timespec"; exit 1; }
__chkTime() { echo "${args[$1]}"|grep -q"[0-9]\{2\}:[0-9]\{2\}" || { echo "${progn} [FATAL]: wrong time format." && exit 127; }; }
# Check args
if [ "$argn" -lt "3" -o "$argn" -gt "5" ]; then echo "${progn} [FATAL]: not enough args."; __help; fi
# Check duration timespec
__chkTime 1
# At time and date
cap="${args[0]}"; len="${args[1]}"; unset args[0] args[1]
args=(${args[@]}); case "${#args[@]}" in
1) __chkTime 0; time="${args[0]}";;
2) __chkTime 0; time="${args[0]}"; date="${args[1]}";;
0|*) __help;; esac
# Start job one minute in advance (for setup, load, app startup, whatever)
time_h="${time:0:2}"; time_m="${time:3:2}"
case "$time_m" in 00) time_m="59"
case "$time_h" in 00) time_h="23";; *) time_h=$[${time:0:2}-1];; esac;;
*) time_m=$[${time:3:2}-1];; esac
if [ ${#time_m} = "1" ]; then time_m="0${time_m}"; fi
if [ ${#time_h} = "1" ]; then time_h="0${time_h}"; fi
starttime="${time_h}:${time_m}"
# Use tempfile for dumping at job
t="/tmp/${progn}.at.$$"; if [ -f "$t" ]; then rm -f "$t"; fi
cat <<EOC > "$t"
TMPDIR=\$(mktemp -td ${progn}.XXXXXXXXXX) && {
streamer -n ntsc -b 24 -t ${time} -s 480x480 -r 29.970 -R 48000 \
-o "\${TMPDIR}/stream0.avi" -f mjpeg -j 95 -F stereo &&\
mencoder -idx "\${TMPDIR}/stream0.avi" -ovc copy -oac copy -o "${capdir}/${cap}.avi"
cd; rm -rf "\${TMPDIR}"
}
EOC
#...and clean up
at -f "$t" "$starttime" "$date"; rm -f "$t"
exit 0
This script accepts "capturename duration at-timespec" params, where at-timespec can be queued as HH:MM or HH:MM DD.MM.YYYY. YMMV(VM).