#!/bin/sh ######## cgiの設定がなされていません。 ######## ##### menat-vs.cgi capture file utility version=0.9.7-rc4 ma_user="$REMOTE_USER" ma_host="$REMOTE_ADDR" ma_ref="$HTTP_REFERER" exe_hn=`hostname` pn_time=`date '+%Y-%m-%d %a %H:%M'` user_h=/var/menat menat_sys_d=/etc/menat vs_ls="`cat $menat_sys_d/vs.list`" menat_version=`head -n 1 $user_h/version` menat_bin=$user_h/bin menat_sad=$menat_bin/menat-sad.sh menat_midentify=$menat_bin/menat-midentify n_ident() { if [ "$1" = 0 ];then dvn=0 dvn_v=0 else dvn=`expr "$1" + 0 2>/dev/null`;dvn_v=$? fi if [ $dvn_v = 0 ];then ni_v=$1 while [ ${ni_v:0:1} = 0 ]&&[ ${#ni_v} != 1 ];do ni_v=${ni_v#0} if [ ${#ni_v} = 1 ];then break fi done echo $ni_v return 0 else echo ${2:-unknown} return $dvn_v fi } ft_date() { if [ "$2" = 1 ];then f_ft=`find $1 -maxdepth 0 -follow -printf '%TY-%Tm-%Td %Ta %TH:%TM\n'`;f_v=$? else f_ft=`find $1 -maxdepth 0 -follow -printf '%TY%Tm%Td%TH%TM\n'`;f_v=$? fi if [ $f_v = 0 ];then echo $f_ft return 0 else return $f_v fi } ##### .ht files ###### if [ -d .htdir ];then htdir=".htdir/" else htdir="" fi ma_htrtm=$htdir$ma_htrtm ma_htmnt2=$htdir.htmnt2 ma_htreload=$htdir.htreload.$ma_host ###################################################### ###################################################### back_qs="$QUERY_STRING" rtm=`date '+%d%H%M%S'` tt_YmdHM=`date '+%Y%m%d%H%M'` export LANG=ja_JP.eucJP m_v0=`echo $QUERY_STRING|sed 's/%/\\\\x/g'` m_v=`printf "$m_v0\n"` if [ "$m_v" ];then dg=`echo $m_v|sed 's/&/ /g'` for qsv in $dg ;do ds_vs_v=${qsv%%_*} if [ "$ds_vs_v" = kousin ];then vs_hn_0=${qsv#kousin_};vs_hn=${vs_hn_0%_*=予約登録の更新} mnt2=${vs_hn_0%%=*} mnt2=${mnt2#*_} conf=1 else if [ ! "${qsv##*\$*}" ]||[ ! "${qsv##*\(*}" ]||[ ! "${qsv##*\`*}" ];then continue else eval $qsv qs_ls="$qs_ls $qsv" fi fi done fi b_qs="start_t=$start_t&tlong=$tlong&ch=$ch&f_name=$f_name" if [ ! "$vs_hn" ];then if [ -d $user_h/$exe_hn ];then vs_name=$exe_hn vs_hn=${exe_hn%%.*} vs_hn_ok=1 fi if [ "$vs_hn_ok" != 1 ];then if [ "$vs_ls" ];then for t in $vs_ls ;do if [ -d $user_h/$t/vfiles ];then vs_name=$t break fi done else if [ -d $user_h/localhost/vfiles ];then vs_name=localhost elif [ -d $user_h/`hostname`/vfiles ];then vs_name=`hostname` fi fi fi if [ ! "$vs_name" ];then vs_err="ビデオサーバの設定に不備があります。vs.list、/var/menat以下のディレクトリ構造を確認してください。" fi else if [ "$vs_hn" = localhost ];then if [ -d $user_h/localhost/vfiles ];then vs_name=localhost fi elif [ "$vs_ls" ];then for t in $vs_ls ;do vs_ls_ok=0 ma_h_ok=0 if [ ${t%%.*} = $vs_hn ];then vs_ls_ok=1 if [ -d $user_h/$t/vfiles ];then vs_name=$t ma_h_ok=1 break fi fi done else if [ -d $user_h/localhost/vfiles ];then vs_name=localhost vs_err="vs.listを設定して下さい。" else vs_name=localhost vs_err="vs.listを設定して下さい。" fi fi if [ ! "$vs_name" ];then vs_name=localhost if [ "$vs_ls_ok" = 1 ];then vs_err="${vs_hn}のディレクトリ設定に誤りがあります。" else vs_err="${vs_hn}は正しいビデオサーバ名ではありません。" fi fi fi vs_hn=${vs_name%%.*} vs_h=$user_h/$vs_name menat_h=$vs_h/menat menat_h_t=$menat_h/tmp ma_h=$vs_h/vfiles ma_h_t=$ma_h/tmp menat_lock=$menat_h_t/lock.menat ma_his_h=$menat_h_t/ma_history admin_host=`hostname -i` ma_dvc=`df $ma_h|tail -n 1|cut -d' ' -f1` exe_hn_addr=$admin_host vs_hn_addr=`host $vs_name`;vs_hn_addr=${vs_hn_addr##* } if [ $ma_host = $vs_hn_addr ];then exe_h_on=1 auth_v=0 admin_v=0 else if [ "$vs_hn" = localhost ]||[ $exe_hn_addr = $ma_host ];then exe_h_on=1 auth_v=0 admin_v=0 else exe_h_on=0 fi fi sudo_list=`sudo -l -S<

ma_bp.db
ma_bp=${ma_bp:-none}
bp_mx=${bp_mx:-none}

" >$menat_h_t/ma_bp.db ls -lrt $ma_bp/ >>$menat_h_t/ma_bp.db LANG=C echo "
`date '+%Y-%m-%d %a %H:%M'`" >>$menat_h_t/ma_bp.db LANG=ja_JP.eucJP chmod -f 664 $menat_h_t/ma_bp.db chgrp -f menat $menat_h_t/ma_bp.db vs_on_run=1 fi fi if [ -f $menat_sys_d/capture.conf ];then ma_ext=`. $menat_sys_d/capture.conf;echo $ma_ext` fi ma_ext=${ma_ext:-mjp} rmode=${rmode:-0} ###################################################### ###################################################### if [ "`readlink /var/menat/public_html/menat`" = /dev/null ]||[ -f $menat_h_t/dl_ristriction ];then dl_ok=0 else dl_ok=1 fi if [ "$d_load" ];then if [ ! -f $ma_h/$d_load ];then dl_err=1 echo "Content-type: text/html" elif [ "$ma_user" = guest ]||[ ${dl_ok:-0} = 0 ];then dl_auth_err=1 echo "Content-type: text/html" else length=`du -b $ma_h/$d_load|cut -f1` nv=${d_load##*.} if [ "$nv" = mpg ];then echo "Content-type: video/mpeg" elif [ "$nv" = wmv ];then echo "Content-type: video/x-ms-wmv" else echo "Content-type: application/octet-stream" fi echo "Content-length: $length" echo "Connection: close" echo cat $ma_h/$d_load exit 0 fi else echo "Content-type: text/html" echo "Connection: close" fi if [ "$conf" = 1 ];then vs_title="configuration on $vs_hn" elif [ "$vs_his" = 1 ]||[ "$vs_his" = 2 ];then vs_title="ma_history on $vs_hn" elif [ "$vs_hid" = 1 ];then vs_title="ma_h.db on $vs_hn" elif [ "$vs_mid" = 1 ];then vs_title="ma_id.db on $vs_hn" elif [ "$vs_bid" = 1 ];then vs_title="ma_bp.db on $vs_hn" else vs_title="video server disk space information on $vs_hn" fi echo echo " $vs_title " echo " " echo "

" if [ "$shtd" = 1 ];then echo "
現在、ビデオサーバは停止中です。このページは、停止直前の状態を保存したものです。

" h1_vs_name="
video server disk space information
`hostname`
" dpt=513 elif [ "$pvsi" = 1 ];then h1_vs_name="
video server disk space information
$vs_name
" dpt=511 else h1_vs_name="
video server disk space information
$vs_name
" dpt=511 fi if [ "$vs_his" = 1 ]||[ "$vs_his" = 2 ];then margin_1=0 else margin_1=7 fi echo "$h1_vs_name

" ################################################################################################ ################################################################################################ ################################################################################################ ################################################################################################ ################################################################################################ ################################################################################################ ################################################################################################ ################################################################################################ if [ "$vs_err" ];then echo "$vs_err
" fi if [ -f $menat_lock ]||[ -d $menat_lock ];then if [ -d $menat_lock ];then ma_run=0 for t in $menat_lock/* ;do if [ -f $t ];then if [ `grep -c ^ex_sleep= $t` != 0 ];then continue else ma_run=1;n_sz="64";db=dbr echo "現在、キャプチャ中につき、いくつかのオプションが制限されています。
" break fi else continue fi done else ma_run=1;n_sz="64";db=dbr echo "現在、キャプチャ中につき、いくつかのオプションが制限されています。
" fi else ma_run=0 fi ################################################################################################ ################################################################################################ ################################################################################################ ################################################################################################ auth_v_org=$auth_v if [ "$rmf" ];then if [ "$ma_host" = "$admin_host" ];then auth_v=0 else rmf_uid=`grep "^$rmf:" $menat_h_t/ma_id.db|cut -d':' -f5` if [ "$rmf_uid" ];then if [ "$rmf_uid" = "$ma_user" ];then auth_v=0 else auth_v=1 fi else for r_t in `grep -Hc $rmf $menat_h_t/*.mtq` ;do r_t_v=${r_t#*:} if [ "$r_t_v" != 0 ];then r_t_f=${r_t%:*} menat_user=`$r_t_f -c menat_user` if [ "$ma_user" = "$menat_user" ];then auth_v=0 else auth_v=1 fi break else continue fi auth_v=1 done fi fi if [ -f $ma_h/$rmf ];then rm_cc=1 if [ "$auth_v" = 0 ]||[ "$admin_v" = 0 ];then rm -f $ma_h/$rmf;rs_v=$? if [ $rs_v = 0 ];then prm=0 ed -s $menat_h_t/ma_id.db >/dev/null 2>&1 <$ma_htrtm else prm=1 fi else prm=3 fi elif [ $rm_time != "`cat $ma_htrtm`" ];then echo $rm_time >$ma_htrtm prm=2 fi elif [ $rmode = 1 ]&&[ $rm_time != "`cat $ma_htrtm`" ];then echo $rm_time >$ma_htrtm if [ "$rm_ex" = 1 ];then ht_str=`sed 's/&/ /g'` for r in $ht_str ;do if [ $r = "rmb=%BA%EF%BD%FC" ];then continue fi rn=${r#*=} rn=`find $ma_h -maxdepth 1 -inum $rn` rn=${rn##*/} if [ "$ma_host" = "$admin_host" ];then auth_v=0 else rmf_uid=`grep "^$rmf:" $menat_h_t/ma_id.db|cut -d':' -f5` if [ "$rmf_uid" ];then if [ "$rmf_uid" = "$ma_user" ];then auth_v=0 else auth_v=1 fi else for r_t in `grep -Hc $rn $menat_h_t/*.mtq` ;do r_t_v=${r_t#*:} if [ "$r_t_v" != 0 ];then r_t_f=${r_t%:*} menat_user=`$r_t_f -c menat_user` if [ "$ma_user" = "$menat_user" ];then auth_v=0 else auth_v=1 fi break else continue fi auth_v=1 done fi fi if [ "$auth_v" != 0 ]&&[ "$admin_v" != 0 ];then np_ls="$np_ls $rn" elif [ ! -f $ma_h/$rn ];then nf_ls="$nf_ls $rn" else rm -f $ma_h/$rn;rv=$? if [ "$rv" = 0 ];then s_ls="$s_ls $rn" else f_ls="$f_ls $rn" fi fi done fi if [ "$s_ls" ];then echo "以下のファイルを削除しました。
$s_ls
" rm -f $menat_h_t/*.t.db* for t in $s_ls ;do ma_his_dd=`grep "^$t .* c" $ma_his_h|head -n1` if [ "$ma_his_dd" ];then new_his_dd="${ma_his_dd% for *}; $pn_time removed by $ma_user on $ma_host" else new_his_dd="$t $pn_time removed by $ma_user on $ma_host" fi ed -s $menat_h_t/ma_id.db >/dev/null 2>&1 </dev/null 2>&1 </dev/null 2>&1 <$f_ls
" fi if [ "$nf_ls" ];then echo "以下のファイルは存在しません。
$nf_ls
" fi if [ "$np_ls" ];then echo "以下のファイルを削除する権限がありません。
$np_ls
" fi fi auth_v=$auth_v_org if [ "$dl_err" = 1 ];then echo "$d_loadは、存在しないファイルです。
" elif [ "$dl_auth_err" = 1 ];then if [ $dl_ok != 1 ];then echo "現在、キャプチャ待ちのためダウンロードは制限されています。
" else echo "guestアカウントではダウンロードできません。
" fi fi if [ "$pvsi" != 1 ];then ma_df0=`df -m $ma_h|tail -n1|tr -s " " " "` ma_df4=`echo $ma_df0|cut -d' ' -f4` #現在の空き容量 ma_df3=`echo $ma_df0|cut -d' ' -f3` ma_df2=`echo $ma_df0|cut -d' ' -f2` #総容量 ma_fm=`du -xmsL $ma_h|tail -n 1|cut -f1` #現在の使用量 ma_ss=$(($ma_df4+$ma_fm)) vs_f_list="`ls $ma_h`" mdss_3="$ma_fm/$ma_ss(MB) 残り $ma_df4(MB)" fi if [ "$mdss" = 1 ];then echo "" echo "" >$menat_h_t/mdss_3 echo sleep_m=${sleep_m:-10} >>$menat_h_t/mdss_3 exit 0 elif [ "$mnt2" ];then if [ "$mnt2" != "`cat $ma_htmnt2`" ];then echo $mnt2 >$ma_htmnt2 if [ "$ma_user" = guest ];then m2_v=guest else echo "予約登録の更新を実行中です。
" res=`sudo /bin/su - menat -c "$menat_sad menat-vs.cgi-$version"`;sad_v=$? fi if [ $sad_v = 0 ];then echo "" if [ "$res" ];then echo "予約登録が完了しました。" else echo "登録情報が更新されました。" fi elif [ "$m2_v" = guest ];then echo "guestには許可されていない操作です。" else echo "登録情報の更新に失敗しました。" fi fi echo "

" exit 0 fi ##################################################################################################### ##################################################################################################### ##################################################################################################### if [ "$vs_his" ]||[ "$vs_mid" = 1 ]||[ "$vs_hid" = 1 ]||[ "$vs_bid" = 1 ]||[ "$conf" = 1 ];then if [ $ma_run = 1 ];then echo "
" else pn=0 h_mode=${h_mode:-1} if [ "$vs_his" ];then if [ ${his_back:0} = 1 ];then ma_his_h=$ma_his_h.back if [ $vs_his = 1 ];then vs_his_p=2 else vs_his_p=1 fi if [ ${pvsi:-0} = 1 ];then vs_back_p2="&his_back=1&pvsi=1" vs_his_back=" ma_history" else vs_back_p2="&his_back=1" vs_his_back=" ma_history" fi vs_back_p3=".back" elif [ -f $ma_his_h.back ];then if [ ${pvsi:-0} = 1 ];then vs_his_back=" ma_history.back" vs_back_p2="&pvsi=1" else vs_his_back=" ma_history.back" fi fi if [ $vs_his = 1 ];then echo "

ma_history$vs_back_p3 削除順

" echo "作成順$vs_his_back
" sed "/ cmp-remove/s/^//;/ cmp-remove/s/\$/<\/span>/;/ remove/s/^//;/ remove/s/\$/<\/span>/;s/\$/
/" $ma_his_h|tac echo "
" else echo "

ma_history$vs_back_p3 作成順

" echo "削除順$vs_his_back
" sort -rk2 $ma_his_h|sed "/ cmp-remove/s/^//;/ cmp-remove/s/\$/<\/span>/;/ remove/s/^//;/ remove/s/\$/<\/span>/;s/\$/
/" echo "
" fi his_ln=`wc -l <$ma_his_h` pn=1 elif [ "$vs_mid" = 1 ];then echo "

ma_id.db

" echo "" sed 's/$/
/' $menat_h_t/ma_id.db echo "
" his_ln=`wc -l <$menat_h_t/ma_id.db` pn=0 elif [ "$vs_hid" = 1 ];then echo "

ma_h.db

" sed 's/<[^>]*>//g;s/$/
/' $menat_h_t/ma_h.db his_ln=`wc -l <$menat_h_t/ma_h.db` pn=0 elif [ "$vs_bid" = 1 ];then http_bp=${http_bp:-bp} if [ "$vs_on_run" = 1 ]&&[ -d $http_bp ]&&[ ${dl_ok:-0} = 1 ];then echo -n "

ma_bp.db
ma_bp=${ma_bp:-none}
bp_mx=${bp_mx:-none}

" his_ln=0 for t in `ls -rt $http_bp` ;do bp_ls_t0=`ls -l $http_bp/$t`;bp_ls_t1=${bp_ls_t0% *} href_bp_fn="$t" echo "$bp_ls_t1 $href_bp_fn
" his_ln=$(($his_ln+1)) done pn=0 else sed 's/$/
/' $menat_h_t/ma_bp.db his_ln=`wc -l <$menat_h_t/ma_bp.db` pn=2 fi fi if [ "$conf" = 1 ];then init_dn=`grep :initdefault: /etc/inittab|cut -d':' -f2` for t in $rc_v ;do bl=${t#*:} n=${t%:*} if [ $bl = on ]&&[ "$init_dn" = $n ];then d_ok=1 break else d_ok=0 fi done menat_sudo_v=`sudo -l|grep 'NOPASSWD: /bin/su - menat -c*'` v4l_v=`grep ' ' /etc/security/console.perms` if [ ! "$v4l_v" ];then v4l_v=`grep ' ' /etc/security/console.perms.d/50-default.perms` fi sound_v=`grep ' ' /etc/security/console.perms` if [ ! "$sound_v" ];then sound_v=`grep ' ' /etc/security/console.perms.d/50-default.perms` fi console_vp=`echo $v4l_v|cut -d' ' -f2` console_sp=`echo $sound_v|cut -d' ' -f2` def_vp=`echo $v4l_v|cut -d' ' -f4` def_sp=`echo $sound_v|cut -d' ' -f4` atr_vp=`echo $v4l_v|cut -d' ' -f5` atr_sp=`echo $sound_v|cut -d' ' -f5` if [ "$console_vp" = 0666 ]&&[ "$console_vp" = "$console_sp" ];then def_vp2=${def_vp:1:2} def_sp2=${def_sp:1:2} if [ "$def_vp2" = 66 ]&&[ "$def_sp2" = 66 ];then if [ $atr_vp != ${atr_vp#*.} ]&&[ $atr_sp != ${atr_sp#*.} ];then if [ ${atr_vp#*.} = menat ]&&[ ${atr_sp#*.} = menat ];then pam_ok=1 else pam_ok=0 fi else pam_ok=0 fi else pam_ok=0 fi else pam_ok=0 fi for t in menatd menat_sudo_v pam_ok ;do if [ $t = menatd ];then if [ "$d_ok" = 0 ];then err_str=$t else ok_str=$t fi fi if [ $t = menat_sudo_v ];then if [ ! "$menat_sudo_v" ];then if [ ! "$err_str" ];then err_str=sudo else err_str="$err_str,sudo" fi else if [ ! "$ok_str" ];then ok_str=sudo else ok_str="$ok_str,sudo" fi fi fi if [ $t = pam_ok ];then if [ "$pam_ok" = 0 ];then if [ ! "$err_str" ];then err_str=pam else err_str="$err_str,pam" fi else if [ ! "$ok_str" ];then ok_str=pam else ok_str="$ok_str,pam" fi fi fi done if [ ! "$err_str" ];then echo " menatは設定済みです。

" else if [ "${ok_str}" ];then echo " ${ok_str}が設定済みです。
" fi echo " ${err_str}が未設定です。
初期設定について

" fi echo "" cat /var/menat/version|sed 's/$/
/;s/:version=/-/' echo "

" else echo "total line number, $((${his_ln:-1}-$pn)).

" fi if [ ${conf:-0} = 1 ];then echo "hostname -- " hostname echo "
IP address -- " hostname -i echo "
CPU -- " grep "model name" /proc/cpuinfo |cut -d':' -f2 vs_pwr=`grep "cpu MHz" /proc/cpuinfo |cut -d':' -f2` echo "${vs_pwr}MHz
" for t in `grep MemTotal /proc/meminfo` ;do ram_sz=`expr $t / 1024`;dvn_v=$? if [ $dvn_v = 0 ];then echo "RAM -- ${ram_sz}MB
" break fi done if [ ${sad_ok:-0} != 1 ];then echo "
" fi fi if [ "$pvsi" = 1 ];then if [ "$vs_his" ];then echo " 戻る" else echo " 戻る" fi else if [ "$vs_his" ]||[ "$conf" = 1 ];then if [ "$conf" = 1 ];then if [ $sad_ok = 1 ]&&[ $ma_run = 0 ];then echo " 
" echo ${rtm%?} >$ma_htmnt2 fi fi echo " 戻る" else echo " 戻る" fi fi if [ "$vs_his" ];then if [ "$pvsi" = 1 ];then echo " ma_h.db" echo " ma_id.db" echo " ma_bp.db" else echo " ma_h.db" echo " ma_id.db" echo " ma_bp.db" fi fi fi echo "

" echo "menat-vs.cgi-$version $menat_version" echo '
' exit 0 fi ################################################################################################### ################################################################################################### ################################################################################################### if [ "$rmf" ];then if [ "$prm" = 0 ];then echo "$rmfは削除されました。
" rm -f $menat_h_t/*.t.db* ma_his_dd=`grep "^$rmf .* c" $ma_his_h|head -n1` if [ "$ma_his_dd" ];then new_his_dd="${ma_his_dd% for *}; $pn_time removed by $ma_user on $ma_host" else new_his_dd="$rmf $pn_time removed by $ma_user on $ma_host" fi ed -s $ma_his_h >/dev/null 2>&1 < $rmfの削除に失敗しました。
" elif [ "$prm" = 2 ];then echo "$rmfは既に削除されています。
" elif [ "$prm" = 3 ];then echo "$rmfを削除する権限がありません。
" fi fi if [ $ma_df4 -lt ${ds_wrn:-2048} ];then echo "" echo "Warning! Disk space shortage!" else echo "" fi echo "$ma_fm/$ma_ss(MB) 残り $ma_df4(MB)" if [ $ma_df4 -lt ${ds_wrn:-2048} ];then echo "
" fi echo "
" echo "" date '+%Y年 %-m月%_d日 %a曜日 %H:%M' if [ -f $menat_h_t/shut_al ]&&[ "$shtd" != 1 ];then vs_s=`ping -q -w 1 -c 1 $vs_name >/dev/null 2>&1;echo $?` if [ $vs_s = 0 ];then shut_al="
now in shutdown process." fi fi echo "$shut_al
" export LANG=C for t_t in `ls $menat_h` ;do tt_t=$t_t tt_t_12=${tt_t%.*.mtq} t_t=$menat_h/$t_t dvn=`n_ident $tt_t_12`;dvn_v=$? if [ ${#tt_t_12} != 12 ]||[ -d $t_t ]||[ $dvn_v != 0 ];then continue fi nx_tY=${tt_t_12:0:4} nx_tm=${tt_t_12:4:2} nx_td=${tt_t_12:6:2} nx_tH=${tt_t_12:8:2} nx_tM=${tt_t_12:10:2} nx_exe_s=`date '+%s'` nx_exp_1h_s=`date -d "$nx_tY-$nx_tm-$nx_td $nx_tH:$nx_tM" '+%s'` exp_nx_s=$(($nx_exp_1h_s-$nx_exe_s)) nx_ext_m=$(($exp_nx_s/60)) nx_ext_m_r=$(($exp_nx_s%60)) if [ $nx_ext_m_r -ge 30 ];then nx_exe_t=$(($nx_ext_m+1)) else nx_exe_t=$nx_ext_m fi if [ $nx_exe_t -le 0 ];then continue fi if [ `grep -c ' menat_ends$' $t_t` != 0 ];then continue fi p_ma_ch=`$t_t -c pch`;ma_ch=`$t_t -c ch` t_epm=`$t_t -c time_epm` p_t_epm=${t_epm}分 p_f_name=`$t_t -c name_f` nx_title=`$t_t -c iepg_title` if [ "$nx_title" ];then nx_title="title=\"$nx_title\"" fi p_bf_name=${p_f_name##*/} opt1=`$t_t -c opt1` if [ "$opt1" ];then p_bf_name=$p_bf_name:$opt1 fi nx_ma=`date -d "$nx_tY-$nx_tm-$nx_td $nx_tH:$nx_tM" '+%Y-%m-%d %a %H:%M'` nx_ma="$nx_ma $p_t_epm $p_ma_ch $p_bf_name" nx_prg=${t_t##*/} break done if [ ! "$nx_ma" ];then nx_ma="未定" fi if [ "$ma_run" = 1 ];then if [ -d $menat_lock ];then for t in `ls -rt $menat_lock` ;do ma_dd=`head -n 1 $menat_lock/$t`;p_ma_dd=${ma_dd%%::*} echo " 進行中のキャプチャは、$p_ma_dd です。
" done elif [ -r $menat_lock ];then ma_dd=`head -n 1 $menat_lock`;p_ma_dd=${ma_dd%%::*} echo " 進行中のキャプチャは、$p_ma_dd です。
" fi else nx_ma=" $nx_ma" fi if [ $dl_ok = 0 ];then if [ ${ma_run:-0} != 1 ];then dl_rist_str=" 現在、キャプチャ待ちのためダウンロードが制限されています
" fi dl_rist=1 fi echo " 次のキャプチャ予定は、$nx_ma です。
$dl_rist_str" if [ ${shtd:-0} != 1 ];then echo " web utility on $vs_hn" fi echo "
" if [ ${nx_exe_t:-61} -lt 60 ]&&[ "$nx_ma" != 未定 ];then echo "

次のキャプチャは、${nx_exe_t}分後に開始されます。
" fi echo "

" if [ "$re_db" = 1 ]&&[ "$ma_run" != 1 ];then echo -n >$menat_h_t/ma_id.db.tmp for tt in `ls -t $ma_h` ;do rr=$ma_h/$tt fid="" org_ma="" if [ -d $rr ]||[ ! -f $rr ];then continue fi for jj in `grep -Hc -e \#$tt: $menat_h_t/*.mtq` `grep -Hc -e \#$tt: $menat_h/*.mtq` ;do pv=`echo $jj|cut -d':' -f1` bnv=${pv##*/} cv=`echo $jj|cut -d':' -f2` bnv_12=${bnv%.*.mtq} dvn=`n_ident $bnv_12`;dvn_v=$? if [ "$cv" = 0 ]||[ ${#bnv_12} != 12 ]||[ $dvn_v != 0 ];then continue elif [ `grep -c 'added in que.$' $pv` = 0 ];then continue fi org_b_ln=`grep -n ^\#$tt: $pv|tail -n1|cut -d':' -f1` mqr_ln_ls=`grep -n 'added in que.$' $pv|tail -n1|cut -d':' -f1` if [ $mqr_ln_ls -lt $org_b_ln ];then tmp_ma_org=0 else tmp_ma_org=1 continue fi org_ma=$pv ma_org_b=$bnv break done if [ ! "$org_ma" ];then if [ -f $menat_h_t/ma_id.db ];then re_f_id=`grep "^${tt}:" $menat_h_t/ma_id.db|tail -n1` if [ "$re_f_id" ]&&[ ! "$fid" ];then fid=$re_f_id db_ma_user=`echo $re_f_id|cut -d':' -f5` db_ma_host=`echo $re_f_id|cut -d':' -f6` db_ma_id=`echo $re_f_id|cut -d':' -f7` pch=`echo $re_f_id|cut -d':' -f9` fi fi if [ ! "$fid" ];then db_ma_user=unknown db_ma_host=unknown db_ma_id="x;x;x" pch="?ch" fi ma_ind=`ls -i $ma_h/$tt`;ma_ind=${ma_ind% *} db_ma_sz=`du -m $rr|cut -f1` fid="$tt:$ma_ind:removed:unknown:$db_ma_user:$db_ma_host:$db_ma_id:$db_ma_sz:$pch" else mqr_ln=`grep -n 'added in que.$' $org_ma|tail -n1|cut -d':' -f1` org_b_l2=`grep -n ^\#${tt}: $org_ma|tail -n1|cut -d':' -f1` if [ $mqr_ln -lt $org_b_l2 ];then ma_ind=`ls -i $ma_h/$tt`;ma_ind=${ma_ind% *} mf_ind=`ls -i $org_ma`;mf_ind=${mf_ind% *} else org_b_ln=`grep -n ^\#$tt: $pv|tail -n1|cut -d':' -f1` mx_mqr_ln=`grep -n 'added in que.$' $pv|tail -n1|cut -d':' -f1` ma_ind=`sed -n "${mx_mqr_ln}p" $org_ma|cut -d' ' -f4` mf_ind=unknown fi if [ "`$org_ma -c version`" '>' 1.1.5 ];then echo "new version
" db_ma_user=`$org_ma -c menat_user` db_ma_host=`$org_ma -c menat_host` ma_org_id=`$org_ma -c org_id` ma_prs_id=`$org_ma -c prs_id` ma_sr_id=`$org_ma -c sr_id` db_ma_id="$ma_org_id;$ma_prs_id;$ma_sr_id" db_ma_sz=`du -m $rr|cut -f1` pch=`$org_ma -c pch` else db_ma_user=`grep ^menat_user= $org_ma|head -n 1|cut -d'=' -f2` db_ma_host=`grep ^menat_host= $org_ma|head -n 1|cut -d'=' -f2` db_ma_id=`grep ^org_id= $org_ma|head -n 1|sed 's/org_id=//;s/prs_id=//;s/sr_id=//'` pch=`grep ^pch= $org_ma|cut -d'=' -f2` fi db_ma_sz=`du -m $rr|cut -f1` fid="$tt:$ma_ind:$ma_org_b:$mf_ind:$db_ma_user:${db_ma_host% }:$db_ma_id:$db_ma_sz:${pch:-?ch}" fi echo "$fid

" echo $fid >>$menat_h_t/ma_id.db.tmp done mv -f $menat_h_t/ma_id.db.tmp $menat_h_t/ma_id.db chgrp -f menat $menat_h_t/ma_id.* chmod -f 664 $menat_h_t/ma_id.* rm -f $menat_h_t/$ma_user.t.$db fi #################################################################################### #################################################################################### #################################################################################### ############################################################ ############### compress information start ################# ############################################################ for k in $ma_h_t/* ;do k=${k##*/} if [ "$ma_run" = 1 ]||[ "$k" = '*' ]||[ "$m2_cmp" = 1 ];then break fi echo "
" if [ `ps awx --width 512|grep -v grep|grep -c "mencoder .*$k"` = 0 ]&&[ ${k%%.*} != hogeout ];then echo "$ma_h_tに予期せぬファイル、$kが存在します。

" continue fi if [ ${k%%.*} = hogeout ];then if [ $k = hogeout.m2v ];then m2_cmp=1 ps_men=`ps axw --width 512 |grep -v grep|grep mpeg2.sh` org_f=${ps_men#*-i };org_f=${org_f% *} k2=${ps_men#*-o };k2=${k2%% *};k2=${k2##*/} k=$k2 echo "****** $k2 圧縮プロセス情報 ******
" else continue fi else echo "****** $k 圧縮プロセス情報 ******
" fi n_time=`date '+%Y%m%d%H%M'` c_bn=${k%.*} cmp_lock_f=$menat_h_t/lock.$c_bn if [ "$m2_cmp" = 1 ];then for t in $ma_h_t/hogeout.* ;do nf_sz_t=`du -m $t|cut -f1` nf_sz=$((${nf_sz:-0}+$nf_sz_t)) done else nf_sz=`du -m $ma_h_t/$k|cut -f1` fi cmp_st=`grep ^menat_cmp_id $cmp_lock_f|tail -n 1`;cmp_st=${cmp_st##* } cmp_st_n=$cmp_st p_cmp_st=`grep 'compress started' $cmp_lock_f|tail -n 1|cut -d' ' -f4-6` p_cmp_st=${p_cmp_st%%,*} dvn=`n_ident $cmp_st_n`;cnn=$? cmp_d_t=`grep $k $menat_h_t/ma_h.db.t` if [ "$m2_cmp" = 1 ];then vbitrate=`$menat_midentify $ma_h_t/hogeout.m2v|cut -d':' -f4` vbitrate=${vbitrate%kbps} else ps_men=`ps awx --width 512|grep -v grep|grep "mencoder .*$k"` ps_men_l=`echo $ps_men|sed 's/:/ /g'` org_f=${ps_men_l##* } fi if [ ! -f "$org_f" ];then if [ -f $menat_h_t/lock.${k%.*} ];then org_f_ap=`grep org_f_ap= $menat_h_t/lock.${k%.*}|head -n1|cut -d'=' -f2` if [ -f "$org_f_ap" ];then org_f=$org_f_ap else lock_err=1 break fi else lock_err=1 break fi fi org_fd=`$menat_midentify $org_f` org_f_ls="$org_f_ls $org_f" org_sz=`du -mL $org_f|cut -f1` org_vbr=`echo $org_fd|cut -d':' -f4` org_t7=`echo $org_fd|cut -d':' -f7`;org_t7=${org_t7%s} org_tM7=${org_t7%m*} org_tS=$(($org_tM7*60+${org_t7#*m})) if [ $org_tS = 0 ];then org_sol_w=`echo $org_fd|cut -d':' -f2|cut -d'x' -f1` if [ $org_sol_w -gt 400 ];then p_vbr=12000 else p_vbr=6000 fi org_tS=$(($(($org_sz*1024*8))/$p_vbr)) fi cmp_mt=$org_tS for cmp_vv in $ps_men ;do if [ "$cmp_vv" = "-vf" ]&&[ ! "$lk" ];then lk=1 elif [ "$m2_cmp" = 1 ]&&[ "$cmp_vv" = "-f" ]&&[ ! "$lk" ];then lk=1 elif [ "$lk" = 1 ];then flt_opt=$cmp_vv lk=2 break fi done for cmp_v in $ps_men_l ;do if [ ! "$cmp_v" ];then continue elif [ ! "${cmp_v##*\$*}" ]||[ ! "${cmp_v##*\(*}" ]||[ ! "${cmp_v##*\`*}" ];then continue fi cmp_v_2=${cmp_v##*=} if [ "$cmp_v" != "$cmp_v_2" ];then eval $cmp_v fi done if [ "$bitrate" ]&&[ ! "$vbitrate" ];then vbitrate=$bitrate fi if [ "$mbd" ];then p_mbd="mbd=$mbd" else p_mbd="" fi if [ "$ps_men_l" ]&&[ ! "${ps_men_l##*-oac copy*}" ];then abitrate=`$menat_midentify -a $org_f|grep ID_AUDIO_BITRATE=|tail -n1|cut -d'=' -f2` abitrate=$(($abitrate/1024)) fi if [ "$abitrate" ];then abr_byte=$(($abitrate/8)) else abr_byte=28 fi if [ ! "$vbitrate" ];then vbr_byte=97 else vbr_byte=$(($vbitrate/8)) fi tbr=$(($vbr_byte+$abr_byte));pcmp_tS=$(($nf_sz/$tbr)) if [ ! "$cmp_mt" ]||[ $n_t != 0 ];then cmp_mt0=`grep ^$c_bn $menat_h_t/lock.$c_bn|tail -n1|cut -d':' -f7` cmp_mt1=${cmp_mt0%m*} cmp_mt2=${cmp_mt0#*m};cmp_mt2=${cmp_mt2%s} cmp_mt=$((60*$cmp_mt1+$cmp_mt2)) dvn=`n_ident $cmp_mt`;dvn_v=$? if [ ! "$cmp_mt" ]||[ $dvn_v != 0 ];then cmp_mt=0;cmp_err=$k fi fi sf_sz=$(($(($org_tS*$tbr))/1024)) rf_sz=$(($sf_sz-$nf_sz)) w_tY=${cmp_st_n:0:4} w_tm=${cmp_st_n:4:2} w_td=${cmp_st_n:6:2} w_tH=${cmp_st_n:8:2} w_tM=${cmp_st_n:10:2} if [ "$cnn" != 0 ]||[ "$cmp_mt" = 0 ];then for t_t in `ls -t $ma_h` ;do t_vv=`$menat_midentify $ma_h/$t_t|cut -d':' -f 3` if [ ! "$t_vv" ];then continue fi cmp_st_n=`ft_date $ma_h/$t_t` cmp_st_n=$(($cmp_st_n+5)) if [ $cmp_st_n -gt $n_time ];then cmp_st_n=$(($n_time-2)) fi break done cmp_st="$w_tY-$w_tm-$w_td $w_tH:$w_tM" p_cmp_st="$w_tY-$w_tm-$w_td `date '+%a'` $w_tH:$w_tM" p_jstr1="推定圧縮開始時刻" fi ###################### past second p_ts ####################### p_ts=$((`date '+%s'`-`date -d "$w_tY$w_tm$w_td $w_tH:$w_tM" '+%s'`)) if [ "$p_ts" = 0 ];then p_ts=60 fi cap_t_ls=`grep ^cap_time= $cmp_lock_f` if [ "$cap_t_ls" ];then for t in $cap_t_ls ;do t1=${t%%:*};cap_t_s=${t1#*=} p_ts=$(($p_ts-$cap_t_s)) done fi ###################### past second end ############################## cmp_SpMB=$(($p_ts/$nf_sz)) cmp_ft_tS=$(($cmp_SpMB*$rf_sz)) tt_rtH=$(($cmp_ft_tS/3600));tt_rtH_M=$(($cmp_ft_tS%3600)) tt_rtM=$(($tt_rtH_M/60));tt_rtH_S=$(($tt_rtH_M%60)) if [ $tt_rtH_S -ge 30 ];then tt_rtM=$(($tt_rtM+1)) if [ "$tt_rtM" = 60 ];then tt_rtH=$(($tt_rtH+1));tt_rtM=0 fi fi if [ "$tt_rtH" = 0 ];then if [ $tt_rtM -lt 0 ];then tt_rtHM='0分' res_0=1 else tt_rtHM=${tt_rtM}分 fi else tt_rtHM=${tt_rtH}時間${tt_rtM}分 fi if [ ! "$p_jstr1" ];then p_jstr1="圧縮開始時刻" fi es_t=`date -d $cmp_ft_tS'second' '+%Y-%m-%d %a %H:%M'` tt_tH=$(($(($p_ts+$cmp_ft_tS))/3600));tt_tH_M=$(($(($p_ts+$cmp_ft_tS))%3600)) tt_tM=$(($tt_tH_M/60));tt_tH_S=$(($tt_tH_M%60)) if [ $tt_tH_S -ge 30 ];then tt_tM=$(($tt_tM+1)) if [ "$tt_tM" = 60 ];then tt_tH=$(($tt_tH+1));tt_tM=0 fi fi if [ "$tt_tH" = 0 ];then tt_tHM=$tt_tM'分' else tt_tM=$(($tt_tM+1)) if [ "$tt_tM" = 60 ];then tt_tH=$(($tt_tH+1));tt_tM=0 fi tt_tHM=$tt_tH'時間'$tt_tM'分' fi p_sf_sz=$sf_sz'MB';p_nf_sz=$nf_sz'MB';pct=$(($nf_sz*100)) rrt=$(($pct/$sf_sz));t_t=$(($pct%$sf_sz));gtt=$(($sf_sz/2)) if [ $nf_sz -ge $sf_sz ];then p_sf_sz=$nf_sz'MB' elif [ $t_t -ge $gtt ];then rrt=$(($rrt+1)) fi if [ $rrt -gt 100 ];then rrt=100 fi p_nf_sz=$nf_sz'MB' cmp_sp=$(($(($org_tS*$rrt))/$p_ts)) if [ ${#cmp_sp} -lt 3 ];then while [ ${#cmp_sp} != 2 ];do cmp_sp=0$cmp_sp done cmp_sp=0.$cmp_sp else n_t=${#cmp_sp};nn0=$(($n_t-2));nn=${cmp_sp:0:$nn0} fn=${cmp_sp:$nn0:$(($n_t-$nn0))} cmp_sp=$nn.$fn fi pp_tH=$(($p_ts/3600));pp_tM=$(($(($p_ts%3600))/60));pp_tS=$(($(($pp_tM%3600))/60)) if [ $pp_tS -gt 30 ];then pp_tM=$(($pp_tM+1)) fi if [ $pp_tH = 0 ];then pp_tH="" else pp_tH=${pp_tH}時間 fi org_sz_00=$org_sz'00' sz_rt=$(($org_sz_00/$sf_sz)) if [ ${#sz_rt} = 1 ];then sz_rt=0.0$sz_rt elif [ ${#sz_rt} = 2 ];then sz_rt=0.$sz_rt else sz_rt_N=${sz_rt%??};sz_rt_fp=${sz_rt#$sz_rt_N} sz_rt=$sz_rt_N.$sz_rt_fp fi if [ "$res_0" = 1 ];then tt_tHM=${pp_tH}${pp_tM}分 fi if [ "$me_quality" ];then p_xvid="me_quality=$me_quality" fi echo "フィルタオプション $flt_opt $p_mbd$p_xvid
" echo "$p_jstr1 $p_cmp_st 推定圧縮終了時刻 $es_t
" echo "圧縮開始 $pp_tH$pp_tM分経過 残り 約$tt_rtHM 推定総処理時間 約$tt_tHM x$cmp_sp倍速
" echo "推定ファイルサイズ $p_sf_sz 圧縮終了済みファイルサイズ $p_nf_sz $rrt% 圧縮率 x$sz_rt

" done if [ "$lock_err" = 1 ];then echo "unknown

" fi ############################################################ ############### compress information end ################# ############################################################ #################### file table start ###################### ############################################################ if [ "$ma_run" = 1 ];then if [ "$ls_opt" = time ];then ls_op="-rt" db=dbrt ma_ttl="録画終了ファイル一覧
作成時間順に10ファイルのみ表示しています。 容量順に表示する。
" else ls_op="-S" db=dbr ma_ttl="録画終了ファイル一覧
容量順に10ファイルのみ表示しています。 作成時間順に表示する。
" fi elif [ "$shtd" = 1 ]||[ $ma_user = guest ];then ma_ttl="録画終了ファイル一覧" ls_op="-t" elif [ $rmode = 1 ];then ma_ttl="録画終了ファイル一覧  通常モード  reload " ls_op="-t" else ma_ttl="録画終了ファイル一覧  一括削除モード  reload " ls_op="-t" db=db fi t_sz=0 echo "
" echo "$ma_ttl" echo "
" if [ "$ftv" = ct ];then echo "" else echo "" fi if [ "$ma_run" != 1 ];then echo "" else echo "" fi echo "" if [ $rmode = 1 ];then db=dbo echo "" else echo "" fi i=0 if [ "`ls $ma_h_t`" ];then for rr in `ls -t $ma_h_t` ;do rr2=${rr#hw_cap.} if [ -d $ma_h_t/$rr ];then if [ $rr2 = $rr];then continue else hw_cap_run=1 cap_org_b=${rr2%.mpg} fi else hw_cap_run=0 cap_org_b=$rr2 fi if [ $rr = video.settings ];then continue fi if [ -f $menat_lock/$rr2 ];then menat_lock_r=$menat_lock/$rr2 if [ -d $ma_h_t/$rr ];then rrb=$rr2 ma_rr=$ma_h_t/$rr/$rrb.mpg else if [ `grep -c ^hw_cap=1 $menat_lock_r` = 0 ];then rrb=${rr%.mpg} else hw_cap_v=`grep start $menat_lock_r|tail -n1|cut -d':' -f3|cut -c 1` case "$hw_cap_v" in X | W | M ) rrb=${rr%.mpg};; * ) rrb=$rr;; esac fi ma_rr=$ma_h_t/$rr fi elif [ -r $menat_lock ]&&[ `grep -c " ${cap_org_b%.mpg}:" $menat_lock` != 0 ];then if [ -d $ma_h_t/$rr ];then rrb=$rr2 ma_rr=$ma_h_t/$rr/$rrb.mpg else hw_cap_v=`grep start $menat_lock|tail -n1|cut -d':' -f3|cut -c 1` case "$hw_cap_v" in X | W | M ) rrb=${rr%.mpg};; * ) rrb=$rr;; esac if [ `grep -c ^hw_cap=1 $menat_lock` = 0 ];then rrb=${rr%.mpg} fi ma_rr=$ma_h_t/$rr fi menat_lock_r=$menat_lock else menat_lock_r=$menat_h_t/lock.${rr%.$ma_ext} cmp_run=1 rrb=$rr ma_rr=$ma_h_t/$rrb fi cap_r_dd=`grep ^$rrb: $menat_lock_r` if [ "$ma_run" = 1 ]&&[ "$cmp_run" != 1 ]&&[ "$cap_r_dd" ];then bc=" background-color: $cexe_rgb;" fpn_v="fpn=`echo $cap_r_dd|cut -d' ' -f2|cut -d':' -f1`" tmp_fft=" ***ただいま作成中***" tt_size=" `du -m $ma_rr|cut -f1`MB" echo " " continue fi if [ "$m2_cmp" = 1 ]&&[ $rr = hogeout.m2v ];then rmf_v=`ps axw --width 512|grep -v grep|grep -c menat-mpeg2.sh` cf_e=mpg m2_t_ok=1 else rmf_v=`ps axw --width 512|grep -v grep|grep -c "mencoder .*$rr"` cf_e=${rr##*.} fi if [ "$cf_e" = mpg ]||[ "$cf_e" = wmv ];then if [ "$cf_e" = mpg ];then nex=mpg else nex=wmv fi if [ "$rmf_v" != 0 ];then tmp_fft="***ただいま圧縮中***" if [ "$m2_cmp" = 1 ];then tt_size=" ${nf_sz}MB" else tt_size=" `du -m $ma_h_t/$rr|cut -f1`MB" fi rrc=$rr else continue fi bc=" background-color: $cmp2_rgb;" echo " " if [ "$m2_cmp" = 1 ];then ps_men=`ps awx --width 512|grep -v grep|grep menat-mpeg2.sh` else ps_men=`ps awx --width 512|grep -v grep|grep "mencoder .*$rr"` fi if [ "$ma_run" != 1 ];then d_bn=${rr%.$nex} if [ ! "$ps_men" ];then continue elif [ ! "${ps_men##*scale*}" ];then for tt in $ps_men ;do # j=`echo $tt|grep -c scale=` if [ "${tt##*scale=*}" ];then continue else sol=${tt#*scale=} sol=${sol%%,*};sol=${sol%% *} sol=`echo $sol|sed 's/:/x/'` break fi done else sol=sol fi ps_men_l=`echo $ps_men|sed 's/:/ /g'` for cmp_v in $ps_men_l ;do if [ ! "$cmp_v" ];then continue elif [ ! "${cmp_v##*\$*}" ]||[ ! "${cmp_v##*\(*}" ]||[ ! "${cmp_v##*\`*}" ];then continue fi if [ ! "${cmp_v##*=*}" ];then eval $cmp_v fi done set $ps_men while [ "$1" ];do case $1 in "-ofps" ) shift fps_c=$1 shift break ;; * ) shift ;; esac done if [ "$m2_cmp" = 1 ];then acodec=${ps_men#*-a };acodec=${acodec%% *};acodec=${acodec:-mp3} m2_org_f=${ps_men#*-i };m2_org_f=${m2_org_f%% *} rrc=${ps_men#*-o };rrc=${rrc%% *};rrc=${rrc##*/} f_dd=`$menat_midentify $ma_h_t/$rr` vcodec=`echo $f_dd|cut -d':' -f3` vbitrate=`echo $f_dd|cut -d':' -f4` vbitrate=${vbitrate%kbps} fps_c=`echo $f_dd|cut -d':' -f5` cmp_tl=`$menat_midentify $m2_org_f|cut -d':' -f7` else cmp_ls="$rr $cmp_ls" cmp_tl=`echo $org_fd|cut -d':' -f7` if [ $cmp_tl = 0m0s ];then f_M=$(($org_tS/60)) f_S=$(($org_tS%60)) cmp_tl="${f_M}m${f_S}s" fi if [ ${sol:-sol} = sol ];then sol=`echo $org_fd|cut -d':' -f2` fi fi if [ ! "$vcodec" ]||[ ! "$acodec" ]||[ ! "$fps_c" ];then if [ ! "$vcodec" ];then vcodec=`$menat_midentify $ma_h_t/$rr|cut -d':' -f3` fi if [ ! "$acodec" ];then acodec=`$menat_midentify $ma_h_t/$rr|cut -d':' -f6` fi if [ ! "$fps_c" ];then fps_c=`$menat_midentify $ma_h_t/$rr|cut -d':' -f5` fi fi acodec_p="$acodec" vvv=:$vcodec:$vbitrate'kbps': vvv="$vvv" cmp_fd=$sol$vvv$fps_c:$acodec_p:$cmp_tl echo " " else echo "" org_f_ls="$org_f_ls ${ps_men##*/}" fi echo " " continue fi done fi ############################################################################################# ############################################################################################# ############################## file table start ##################################### ############################################################################################# ############################################################################################# if [ "$shtd" = 1 ];then ma_t_db=/dev/null rm -f $menat_h_t/*.t.db* rm -f $htdir.htreload.* else ma_t_db=$menat_h_t/$ma_user.t.$db if [ "$re_load" = 1 ];then if [ "`cat $ma_htreload`" != ${mnt3:-0} ];then echo $mnt3 >$ma_htreload rm -f $ma_t_db fi else ma_h_nn=`ls -lL $ma_h|grep -c ^-` if [ $ma_h_nn != "`grep -c '' $ma_t_db`" ]||[ $ma_h_nn = 0 ];then rm -f $ma_t_db fi fi fi db=${db:-db} if [ "$ma_run" = 1 ]&&[ -f $ma_t_db ]&&[ $ma_h -ot $ma_t_db ]&&[ $ma_h_t -ot $ma_t_db ];then cat $ma_t_db i=db elif [ "$shtd" != 1 ]&&[ -f $ma_t_db ]&&[ $ma_h -ot $ma_t_db ]&&[ $ma_h_t -ot $ma_t_db ];then cat $ma_t_db i=db elif [ "$ma_h_nn" = 0 ];then ma_none=1 else echo >$ma_t_db for tt in `ls $ls_op $ma_h` ;do mid_v=0 if [ -d $ma_h/$tt ];then continue fi if [ $i = 10 ]&&[ "$ma_run" = 1 ];then break fi if [ "$ma_run" != 1 ];then f_d=`grep ^$tt: $menat_h_t/ma_h.db|tail -n 1` f_d=${f_d#$tt:} if [ "$f_d" ]&&[ -f $menat_h_t/ma_h.db.t ];then echo $tt:$f_d>>$menat_h_t/ma_h.db.t else f_d=`$menat_midentify $ma_h/$tt` fd_v0=`echo $f_d|cut -d":" -f2` fd_v1=`echo $f_d|cut -d":" -f3-4` fd_v2=`echo $f_d|cut -d":" -f5` fd_v3=`echo $f_d|cut -d":" -f6` fd_v4=`echo $f_d|cut -d":" -f7` f_d="$fd_v0:$fd_v1:$fd_v2:$fd_v3:$fd_v4" echo $tt:$f_d>>$menat_h_t/ma_h.db.t fi fi f_name=$tt of_size=`du -m $ma_h/$tt|cut -f1`;t_sz=$(($of_size+$t_sz)) o_f_size=$of_size"MB" if [ "$org_f_ls" ];then cmp_run_v=${org_f_ls##*$tt*} cmp_run_v=${cmp_run_v:-1} else cmp_run_v=0 fi tt_f=`grep ^$f_name: $menat_h_t/ma_id.db|tail -n 1|cut -d':' -f3` mtq_ok=0 t_YmdHM=${tt_f%.*.mtq} p_ma_org="" if [ -f $menat_h_t/$tt_f ];then tcr="color: $t4_rgb" fpn_v="past=1&past2=tmp&fpn=$tt_f" mtq_ok=1 p_ma_org=$menat_h_t/$tt_f else mtq_p_ls=`grep -H "^#${tt}:" $menat_h_t/*.mtq` for t_g in `echo "$mtq_p_ls"|tac` ;do t_g_0=${t_g##*:} n_ma_org=${t_g%%:*} if [ `${n_ma_org} -c exe_v` -lt 0 ];then continue fi if [ -f $menat_h_t/${t_g_0} ];then p_ma_org=$menat_h_t/${t_g_0} p_ma_org_b=${t_g_0} mtq_ok=1 fpn_v="past=1&past2=tmp&fpn=$t_g_0" else p_ma_org=${n_ma_org} p_ma_org_b=${p_ma_org##*/} tt_f_e=${t_g_0} mtq_ok=2 fpn_v="past=1&past2=tmp&fpt=$p_ma_org_b&fnt=$tt" fi break done fi if [ "$ftv" = ct ];then f_time_0=`ft_date $ma_h/$tt 1` tcr="color: $t6_rgb" else if [ $mtq_ok = 1 ];then t_Y=${t_YmdHM:0:4} t_m=${t_YmdHM:4:2} t_d=${t_YmdHM:6:2} t_H=${t_YmdHM:8:2} t_M=${t_YmdHM:10:2} f_time_0=`date -d "$t_Y-$t_m-$t_d $t_H:$t_M" '+%Y-%m-%d %a %H:%M'` tcr="color: $t6_rgb" elif [ $mtq_ok = 0 ];then f_time_0=`ft_date $ma_h/$tt 1` tcr="color: $t3_rgb" else ft_mtq=$tt_f_e if [ "$t_YmdHM" = removed ];then tcr="color: $ok2_rgb" else tcr="color: $t1_rgb" fi t_Y=${ft_mtq:0:4} t_m=${ft_mtq:4:2} t_d=${ft_mtq:6:2} t_H=${ft_mtq:8:2} t_M=${ft_mtq:10:2} f_time_0=`date -d "$t_Y-$t_m-$t_d $t_H:$t_M" '+%Y-%m-%d %a %H:%M'` fi fi tpch=`grep $tt $menat_h_t/ma_id.db|tail -n1|cut -d':' -f9` if [ "$tpch" = Composite1 ];then tpch="c-1" elif [ "$tpch" = S-Video ];then tpch="S-v" elif [ ! "$tpch" ]||[ "$tpch" = unknown ];then tpch="?ch" elif [ ${#tpch} = 3 ];then tpch="$tpch" else if [ -x "$p_ma_org" ];then tpch=`$p_ma_org -c pch` fi if [ ! "$tpch" ];then tpch="?ch" fi fi f_time="$f_time_0 $tpch" t_YmdHM="" ref_title="" if [ -f "$p_ma_org" ];then tt_title=`$p_ma_org -c iepg_title` if [ "tt_title" ];then ref_title="title=\"$tt_title\"" fi fi if [ $mtq_ok -gt 0 ];then f_time="$f_time" else f_time="$f_time" fi if [ -L $ma_h/$tt ];then f_size=`du -mL $ma_h/$tt|cut -f1`MB else f_size=$o_f_size fi ttt=${tt%.$ma_ext} f_user=`grep ^$tt: $menat_h_t/ma_id.db|cut -d':' -f5|cut -d'=' -f2` if [ -f $menat_h_t/lock.$ttt ];then psax512=`ps ax --width 512` r_v0=`echo "$psax512"|grep -v grep|grep -c menat-cmp.sh` r_v1=`echo "$psax512"|grep $tt|grep -c "menat-cmp.sh .*-e [13579bdf]"` r_v2=`echo "$psax512"|grep -c $ttt` if [ $r_v0 = 0 ]||[ $r_v2 = 0 ];then f_rm="???" elif [ $r_v1 != 0 ];then f_rm="RMV" else f_rm="WAIT" fi elif [ "$shtd" = 1 ]||[ "$ma_user" = guest ];then f_rm="-" elif [ "$f_user" != "$ma_user" ]&&[ "$auth_v" != 0 ];then f_rm="-" elif [ -w $ma_h ]&&[ -w $ma_h/$tt ];then if [ $rmode = 1 ];then tt_id=`ls -i $ma_h/$tt` tt_id=${tt_id% $ma_h/$tt};tt_id=${tt_id##* } f_rm="" else f_rm="O.K." fi else f_rm="-" fi if [ "$cmp_run_v" = 1 ];then fc=" background-color: $cmp_org_rgb;" elif [ $(($(($i+1))%10)) = 0 ];then fc=" background-color: $bc2_rgb;" elif [ $(($i%2)) = 1 ];then fc=" background-color: $bc1_rgb;" else fc=" background-color: $bc0_rgb;" fi if [ "$ma_run" = 1 ];then ref="$f_name" elif [ "$shtd" = 1 ]||[ "$ma_user" = guest ]||[ ${dl_rist:-0} = 1 ];then ref="$f_name" f_size="$f_size" else if [ $i = 0 ];then mark1=" font-weight: bold;" else mark1="" fi ref="$f_name" f_size=" $f_size" fi echo "" |tee -a $ma_t_db if [ "$ma_run" != 1 ];then echo " " |tee -a $ma_t_db else echo "" |tee -a $ma_t_db fi echo " " |tee -a $ma_t_db i=$(($i+1)) done fi if [ $rmode = 1 ];then echo "" fi if [ ${ma_none:-0} = 1 ]&&[ "$ma_run" != 1 ];then echo "" fi echo '
作成終了時刻キャプチャ開始時刻 chファイル名 ファイルデータファイル名サイズ
削除
$tmp_fft $rrb $tt_size -
$tmp_fft$rrc $cmp_fd$rrc$tt_size -
$f_time $ref $f_d $ref$f_size $f_rm
         

' if [ "$ma_run" != 1 ];then if [ $i = db ];then echo "
合計`grep -c '' $ma_t_db`タイトル 総計`du -sxmL $ma_h|cut -f1`MB  user -- ${ma_user}, *** 作成削除履歴  configuration

" else echo "
合計${i}タイトル 総計${t_sz}MB user -- ${ma_user}, " if [ "$shtd" = 1 ];then echo " 作成削除履歴

" else echo " 作成削除履歴  configuration
" fi fi fi ############################################################ ################# file table end ################### ############################################################ echo "
index of $vs_hn" if [ "$shtd" != 1 ];then echo " reload" echo " web utility on $vs_hn" fi echo " ヘルプ" if [ "$shtd" = 1 ];then echo " 戻る
" else echo " 戻る
" fi echo "

" echo "menat-vs.cgi-$version $menat_version" echo '
' if [ -f $menat_h_t/ma_h.db.t ];then mv -f $menat_h_t/ma_h.db.t $menat_h_t/ma_h.db fi exit 0 #2005-05-21 Sat 19:51 0.8.9-pre2 db viewer was implemented. #2005-05-19 Thu 01:26 0.8.8-rc2 new ls compatibility. #2005-04-26 Tue 21:10 0.8.2 XviD bugs were fixed at 0.8.4-rc1. #2005-04-19 Tue 08:28 0.8.2 XviD was implemented at 0.8.2. #2005-04-18 Mon 06:00 0.8.0 vs_his was implemented at 0.8.0. #2005-04-03 Sun 19:38 0.7.15 remove permission was revised strictly at 0.7.15. #2005-04-02 Sat 11:51 0.7.14 htrtm was revised strictly at 0.7.14. #2005-03-23 Wed 12:15 0.7.3 mpeg2 encoding was implemented unofficialy at 0.7.3. #2005-03-21 Mon 14:21 0.7.0 sad_ok was implemented for security reason at 0.7.0. #2005-03-20 Sun 14:26 0.6.18 dpt number was revised for pvsi at 0.6.18. #2005-03-18 Fri 18:14 0.6.16 t.dbr reload bug was fixed at 0.6.16. #2005-03-07 Mon 13:09 0.6.9 many bug were fixed for menat-0.5.2 at 0.6.9. #2005-02-25 Fri 03:04 0.6.0-pre1 mtq extension was added,new blunch starts. #2005-02-20 Sun 01:11 0.5.3-pre4 t.db was implemented.