All pastes #173445 Raw Edit

Someone

public text v1 · immutable
·published 2006-09-16 22:51 UTC
rendered paste body
#!/bin/bash

ROOTDIR=/store/res/misc/surveillance
Y=`date +'%Y'`
M=`date +'%m'`
D=`date +'%d'`
H=`date +'%H'`
MIN=`date +'%M'`
S=`date +'%S'`

if [ ! -d $ROOTDIR/$Y ]; then
mkdir $ROOTDIR/$Y
fi

if [ ! -d $ROOTDIR/$Y/$M ]; then
mkdir $ROOTDIR/$Y/$M
fi

if [ ! -d $ROOTDIR/$Y/$M/$D ]; then
mkdir $ROOTDIR/$Y/$M/$D
fi

FILENAME=$ROOTDIR/$Y/$M/$D/$H:$MIN:$S.jpg

echo FILENAME=$FILENAME
import -window root $FILENAME

if [ ! -f $FILENAME ]; then
echo Error: $FILENAME not found after supposed creation
else
echo $FILENAME created
fi

exit 0




produces:
in bash - manually executed:
motin@laptop:~$ bin/survdump.sh
/store/res/misc/surveillance/2006/09/16/22:28:47.jpg created

through logged cron:
FILENAME=/store/res/misc/surveillance/2006/09/16/22:32:02.jpg
Error: /store/res/misc/surveillance/2006/09/16/22:32:02.jpg not found after supposed creation
FILENAME=/store/res/misc/surveillance/2006/09/16/22:33:01.jpg
Error: /store/res/misc/surveillance/2006/09/16/22:33:01.jpg not found after supposed creation
FILENAME=/store/res/misc/surveillance/2006/09/16/22:34:01.jpg
Error: /store/res/misc/surveillance/2006/09/16/22:34:01.jpg not found after supposed creation


crontab -l:
* * * * * /home/motin/bin/survdump.sh  >> /tmp/tempcrontext