/
uncenz-ts
executable file
·40 lines (39 loc) · 1.08 KB
/
uncenz-ts
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
#!/bin/bash
#
# uncenz-ts -- set timestamp infix for screencast and dumpcap/tcpdump
#
# Copyright 2015, Miroslav Rovis, www.CroatiaFidelis.hr
#
# released under BSD license, pls. see LICENSE
#
# "ts" is for "time stamp"
ts_var=$(date +%y%m%d_%H%M)
echo $ts_var
if [ -e ".uncenz-ts" ] ; then
ts_var_old=$(cat .uncenz-ts)
#echo $ts_var_old
echo $ts_var_old > .uncenz-ts.old
# read FAKE
if [ "$ts_var" == "$ts_var_old" ]
then echo "We won't overwrite the files just made."
# read FAKE
echo "Wait till this minute is over, then run the script again,"
echo "two sessions in the same minute is a bad idea."
date
# Here we need to kill uncenz-1st for which reason in the working dir there is
# the .uncenz-1st.pid
# We really may only kill it if either ffmpeg or dumpcap/tcpdump are running. However
# this is small inconvenience that I can live with, no time.
kill $(cat .uncenz-1st.pid)
else # echo "is different" ;
# read FAKE
echo $ts_var > .uncenz-ts
# read FAKE
# echo cat .uncenz-ts
# cat .uncenz-ts
fi
else
echo $ts_var > .uncenz-ts
# echo "cat .uncenz-ts"
# cat .uncenz-ts
fi