Make working copy of logging

pull/46/head
Dan Puttick 2017-01-12 14:00:51 -05:00
parent 733b5fd637
commit 05cc4c1155
5 changed files with 22 additions and 25 deletions

View File

@ -16,6 +16,7 @@
clean(){
echo "GROOMER: rc.local done, shutting down."
sleep 60
/sbin/shutdown -P -h now
}
@ -25,13 +26,8 @@ echo "GROOMER: end of boot, running rc.local."
# if [ -e /dev/sda ]; then
# if [ -e /dev/sdb ]; then
# avoid possible misuse
#fdisk -l
echo "Testing, did anything happen." >> /var/tmp/thing.txt
cd /opt/groomer
./init.sh | tee "/var/tmp/groomer_log.txt"
sleep 20
./init.sh
exit 0

View File

@ -1,5 +1,5 @@
DEV_SRC='/dev/sda'
DEV_SRCONE='dev/sda1'
DEV_SRCONE='/dev/sda1'
DEV_DST='/dev/sdb1'
# User allowed to do the following commands without password
@ -11,10 +11,12 @@ ID=`/usr/bin/id -u`
# Paths used in multiple scripts
SRC="src"
DST="dst"
TEMP="/media/${DST}/temp"
ZIPTEMP="/media/${DST}/ziptemp"
LOGS="/media/${DST}/logs"
GROOM_LOG="/var/tmp/groomer_log.txt"
SRC_MNT="/media/src"
DST_MNT="/media/dst"
TEMP="${DST}/temp"
ZIPTEMP="${DST}/ziptemp"
LOGS="${DST}/logs"
GROOM_LOG="/tmp/groom_log.txt"
# commands
SYNC='/bin/sync'

View File

@ -11,16 +11,16 @@ fi
clean(){
echo "GROOMER: Cleaning up after groomer.sh."
cp ${GROOM_LOG} "${DST_MNT}/groomer_log.txt"
# Write anything in memory to disk
${SYNC}
cp "${GROOM_LOG} ${SRC}/groomer_log.txt"
cp "${GROOM_LOG} ${DST}/groomer_log.txt"
# Cleanup source
# Unmount source
pumount ${SRC}
# Cleanup destination
# Clean up and unmount destination
rm -rf ${TEMP}
rm -rf ${ZIPTEMP}
pumount ${DST}
@ -53,10 +53,10 @@ fi
# uid= only works on a vfat FS. What should wedo if we get an ext* FS ?
${PMOUNT} -w ${DEV_DST} ${DST}
if [ ${?} -ne 0 ]; then
echo "GROOMER: Unable to mount /dev/${DEV_DST} on ${DST}"
echo "GROOMER: Unable to mount ${DEV_DST} on ${DST_MNT}"
exit
else
echo "GROOMER: Target USB device (/dev/${DEV_DST}) mounted at ${DST}"
echo "GROOMER: Target USB device (${DEV_DST}) mounted at ${DST_MNT}"
# rm -rf "/media/${DST}/FROM_PARTITION_"*
@ -69,9 +69,8 @@ else
# rm -rf "${ZIPTEMP}/"*
# rm -rf "${LOGS}/"*
fi
${PMOUNT} -w ${DEV_SRCONE} ${SRC}
sleep 30
${PMOUNT} -w ${DEV_SRCONE} ${SRC}
# Groom da kitteh!

View File

@ -17,4 +17,6 @@ clean(){
trap clean EXIT TERM INT
su ${USERNAME} -c ./groomer.sh
fdisk -l |& tee ${GROOM_LOG}
su ${USERNAME} -c ./groomer.sh |& tee ${GROOM_LOG}

View File

@ -8,6 +8,4 @@ set -x
cp /media/sf_ubuntu-shared/Circlean-Ubuntu/fs_filecheck/opt/groomer/init.sh /mnt/rpi/opt/groomer/init.sh
cp /media/sf_ubuntu-shared/Circlean-Ubuntu/fs_filecheck/opt/groomer/groomer.sh /mnt/rpi/opt/groomer/groomer.sh
cp /media/sf_ubuntu-shared/Circlean-Ubuntu/fs_filecheck/opt/groomer/constraint.sh /mnt/rpi/opt/groomer/constraint.sh
cp /media/sf_ubuntu-shared/Circlean-Ubuntu/fs_filecheck/etc/rc.local /mnt/rpi/etc/rc.local
umount /mnt/rpi
cp /media/sf_ubuntu-shared/Circlean-Ubuntu/fs_filecheck/etc/rc.local /mnt/rpi/etc/rc.local