projects
/
outofuni
/
backup.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
hard link instead of cp -r
[outofuni/backup.git]
/
bin
/
backupctrl
diff --git
a/bin/backupctrl
b/bin/backupctrl
index
90640d8
..
792d57f
100755
(executable)
--- a/
bin/backupctrl
+++ b/
bin/backupctrl
@@
-5,13
+5,12
@@
op="pusage"
function detect() {
IFS=$'\n'
for psline in `ps -ef | grep [r]sync`; do
function detect() {
IFS=$'\n'
for psline in `ps -ef | grep [r]sync`; do
- ppid="`echo $psline | cut -d ' ' -f 2`"
- pptime=`echo $psline | \
- sed 's/.*[0-9] \([0-9][0-9]:[0-9][0-9]\) \?.*/\1/'`
+ ppid="`echo $psline | awk '{ print $2 }'`"
+ pptime=`echo $psline | awk '{ print $5 }'`
ppcmd="`echo $psline | \
sed 's/.*\(rsync .*\)/\1/'`"
echo
ppcmd="`echo $psline | \
sed 's/.*\(rsync .*\)/\1/'`"
echo
- echo
detected pos
sible backup process $ppid started at $pptime
+ echo
po
sible backup process $ppid started at $pptime
echo
if [ ! -z "$1" ]; then
if [ "$1" = "kill" ]; then
echo
if [ ! -z "$1" ]; then
if [ "$1" = "kill" ]; then
@@
-33,18
+32,16
@@
function detect() {
if [ ! -f ~/.backup ]; then
echo
echo "backup activated (no rejection file)"
if [ ! -f ~/.backup ]; then
echo
echo "backup activated (no rejection file)"
- echo
detect
else
detect
else
+ txt="`grep ^# ~/.backup | cut -d ' ' -f 2-`"
if [ -z "`cat ~/.backup | grep ^off`" ]; then
echo
if [ -z "`cat ~/.backup | grep ^off`" ]; then
echo
- echo backup activated
- echo
+ echo backup activated, $txt
detect
else
echo
detect
else
echo
- echo backup rejected
- echo
+ echo backup rejected, $txt
detect "kill"
fi
fi
detect "kill"
fi
fi