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(){ clean(){
echo "GROOMER: rc.local done, shutting down." echo "GROOMER: rc.local done, shutting down."
sleep 60
/sbin/shutdown -P -h now /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/sda ]; then
# if [ -e /dev/sdb ]; then # if [ -e /dev/sdb ]; then
# avoid possible misuse
#fdisk -l
echo "Testing, did anything happen." >> /var/tmp/thing.txt
cd /opt/groomer cd /opt/groomer
./init.sh | tee "/var/tmp/groomer_log.txt" ./init.sh
sleep 20
exit 0 exit 0

View File

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

View File

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

View File

@ -17,4 +17,6 @@ clean(){
trap clean EXIT TERM INT 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

@ -9,5 +9,3 @@ cp /media/sf_ubuntu-shared/Circlean-Ubuntu/fs_filecheck/opt/groomer/init.sh /mnt
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/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/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 cp /media/sf_ubuntu-shared/Circlean-Ubuntu/fs_filecheck/etc/rc.local /mnt/rpi/etc/rc.local
umount /mnt/rpi