We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
Any linux bods out there??
Comments
-
fsck.sh contains........................
#!/bin/sh
PROMPT="/sbin/fsck_prompt.sh"
DOFSCK="/sbin/do_fsck.sh"
BOOTCNT="/etc/.bootcount"
LASTIME="/etc/.lastchktime"
rm -f "/etc/.dofsck"
rm -f "/etc/.fsck_prompt"
if [ ! -e "${BOOTCNT}" ];then
echo 1 > "${BOOTCNT}"
fi
CNT=`cat "${BOOTCNT}"`
CNT=`expr "${CNT}" + 1`
echo "${CNT}" > "${BOOTCNT}"
if [ ! -e "${LASTIME}" ];then
CURR=`expr \`date +%s\` / 86400`
echo "${CURR}" > "${LASTIME}"
fi
LAST=`cat "${LASTIME}"`
CURR=`expr \`date +%s\` / 86400`
INTERVAL=`expr ${CURR} - ${LAST}`
if [ -e "/etc/.manualchk" ];then
echo "==>checking filesystem by manually..."
#manual check
rm -f "/etc/.manualchk"
touch "/etc/.needchkmsg"
${DOFSCK}
elif [ -e "/etc/.shutdownflag" ];then
#abnormal shutdown
echo "==>checking filesystem for abnormal shutdown..."
${PROMPT}
else
if [ "${CNT}" -gt 30 ];then
#bootup times
echo "==>checking filesystem for bootup:${CNT}times..."
${PROMPT}
elif [ "${INTERVAL}" -gt 180 ];then
#check interval
echo "==>checking filesystem for interval:${INTERVAL}days..."
${PROMPT}
fi
fi
while [ -e "/etc/.dofsck" ]; do
#wait for fsck completed
sleep 10
done0 -
OK can you cat do_fsck.sh too please4.8kWp 12x400W Longhi 9.6 kWh battery Giv-hy 5.0 Inverter, WSW facing Essex . Aint no sunshine ☀️ Octopus gas fixed dec 24 @ 5.74 tracker again+ Octopus Intelligent Flux leccy0
-
do_fsck.sh looks like this.......................
#!/bin/sh
DOFSCK="/etc/.dofsck"
if [ -e "${DOFSCK}" ];then
echo "fsck in process,exit"
exit 1
fi
if [ -e "/etc/.fsck_prompt" ];then
#check vg0 exists
/sbin/vgchange -ay vg0 >/dev/null 2>&1
RET="$?"
if [ "${RET}" -ne "0" ];then
echo "vg0 doesnt exist,exit"
# exit 1
else
#check lv0 doesnt be mounted
df |grep /DataVolume |grep /dev/vg0/lv0 >/dev/null 2>&1
RET="$?"
if [ "${RET}" -eq "0" ];then
echo "lv0 is mounted,exit"
# exit 1
else
#check lv0 could be mounted
mount /dev/vg0/lv0 /DataVolume >/dev/null 2>&1
RET="$?"
if [ "${RET}" -ne "0" ];then
echo "lv0 couldnt be mounted,exit"
# exit 1
else
FSCK_VG0=1
umount /DataVolume >/dev/null 2>&1
touch "${DOFSCK}"
killall fsck_prompt.sh >/dev/null 2>&1
echo "=====>check /DataVolume ..."
#Turn on ID LED
#/bin/echo 1 >/proc/wixgpio/gpio00
#Turn off PWR LED
#/bin/echo 1 >/proc/wixgpio/gpio06
#Blink USB backup LED
#/usr/bin/wixled_blink gpio10 >/dev/null 2>&1 &
#tst
date #> /tmp/ars
/sbin/fsck.ext3 -fy /dev/vg0/lv0
RET="$?"
echo $RET
#tst
date #>> /tmp/ars
if [ "${RET}" -eq "0" ] || [ "${RET}" -eq "1" ] || [ "${RET}" -eq "2" ];then
echo "No errors OR File system errors corrected"
/usr/sbin/wixsendevent fsck 1 0
elif [ "${RET}" -eq "4" ] || [ "${RET}" -eq "8" ];then
echo "File system errors left uncorrected OR Operational error"
/usr/sbin/wixsendevent fsck 1 1
fi
fi
fi
fi
#check vg1 exists
/sbin/vgchange -ay vg1 >/dev/null 2>&1
RET="$?"
if [ "${RET}" -ne "0" ];then
echo "vg1 doesnt exist,exit"
# exit 1
else
#check lv1 doesnt be mounted
df |grep /DataVolume |grep /dev/vg1/lv1 >/dev/null 2>&1
RET="$?"
if [ "${RET}" -eq "0" ];then
echo "lv1 is mounted,exit"
# exit 1
else
#check lv1 could be mounted
mount /dev/vg1/lv1 /DataVolume >/dev/null 2>&1
RET="$?"
if [ "${RET}" -ne "0" ];then
echo "lv1 couldnt be mounted,exit"
# exit 1
else
FSCK_VG1=1
umount /DataVolume >/dev/null 2>&1
touch "${DOFSCK}"
killall fsck_prompt.sh >/dev/null 2>&1
echo "=====>check /DataVolume ..."
if [ "${FSCK_VG0}" -ne "1" ]; then
#Turn on ID LED
#/bin/echo 1 >/proc/wixgpio/gpio00
#Turn off PWR LED
#/bin/echo 1 >/proc/wixgpio/gpio06
#Blink USB backup LED
#/usr/bin/wixled_blink gpio10 >/dev/null 2>&1 &
fi
#tst
date #> /tmp/ars
/sbin/fsck.ext3 -fy /dev/vg1/lv1
RET="$?"
echo $RET
#tst
date #>> /tmp/ars
if [ "${RET}" -eq "0" ] || [ "${RET}" -eq "1" ] || [ "${RET}" -eq "2" ];then
echo "No errors OR File system errors corrected"
/usr/sbin/wixsendevent fsck 2 0
elif [ "${RET}" -eq "4" ] || [ "${RET}" -eq "8" ];then
echo "File system errors left uncorrected OR Operational error"
/usr/sbin/wixsendevent fsck 2 1
fi
fi
fi
fi
if [ "${FSCK_VG0}" -eq "1" ] || [ "${FSCK_VG1}" -eq "1" ] ; then
#/usr/bin/killall wixled_blink >/dev/null
#Turn off USB LED
#/bin/echo 0 >/proc/wixgpio/gpio10
#Turn off ID LED
#/bin/echo 0 >/proc/wixgpio/gpio00
#Clean file flag
if [ -e "/etc/.manualchk" ];then
rm -f "/etc/.manualchk"
fi
if [ -e "/etc/.needchkmsg" ];then
rm -f "/etc/.needchkmsg"
fi
/bin/echo 0 >/etc/.bootcount
CURR=`expr \`date +%s\` / 86400`
echo "${CURR}" > /etc/.lastchktime
rm -f "${DOFSCK}"
rm -f "/etc/.fsck_prompt"
fi
else
echo "No Prompt"
fi0 -
Crap they write shell scripts like I do , "I will add the comments afterwards", and then I never do give me a week or too or maybe 10 mins .....I am trying to read this , watch question , drink beer and all of that on a small screen :beer:4.8kWp 12x400W Longhi 9.6 kWh battery Giv-hy 5.0 Inverter, WSW facing Essex . Aint no sunshine ☀️ Octopus gas fixed dec 24 @ 5.74 tracker again+ Octopus Intelligent Flux leccy0
-
OK df ..... then post the output please4.8kWp 12x400W Longhi 9.6 kWh battery Giv-hy 5.0 Inverter, WSW facing Essex . Aint no sunshine ☀️ Octopus gas fixed dec 24 @ 5.74 tracker again+ Octopus Intelligent Flux leccy0
-
debitcardmayhem wrote: »Crap they write shell scripts like I do , "I will add the comments afterwards", and then I never do give me a week or too or maybe 10 mins .....I am trying to read this , watch question , drink beer and all of that on a small screen :beer:
No rush, I'm gonna have to hit the sack anyways tbh, early start for work. Guess I should look into sata->usb drive caddies just in case!
Cheers both for your assistance btw. I doubt I'll be around much tomorrow, but I'll keep the thread updated as much as I can0 -
Here you go ...........
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/md0 1929044 156016 1675036 9% /
/dev/md3 972344 19836 903116 2% /var
/dev/ram0 63412 20 63392 0% /mnt/ram0 -
OK I guess you aren't in a rush from post #1 so I will have a proper look later (I will print out the scripts( , hit the sack ) cheersHere you go ...........
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/md0 1929044 156016 1675036 9% /
/dev/md3 972344 19836 903116 2% /var
/dev/ram0 63412 20 63392 0% /mnt/ram4.8kWp 12x400W Longhi 9.6 kWh battery Giv-hy 5.0 Inverter, WSW facing Essex . Aint no sunshine ☀️ Octopus gas fixed dec 24 @ 5.74 tracker again+ Octopus Intelligent Flux leccy0 -
I would only class myself as a "Linux NOOB" and, as such, have had many a !!!!-up to sort out. It seems to me that you are going the long way round an easy problem. What I would do, as already been suggested to you previously, is take out your hard drive, buy a USB to SATA cable for a couple of quid and install this FREE utility on your Windows OS http://sourceforge.net/projects/ext2read/ and you'll be able to see everything on your HDD. If you have deleted your files, use another FREE utility Recuva to restore http://www.piriform.com/recuva.If I had 8 hours to chop down a tree, I'd spend 6 hours sharpening my axe0
-
impecunious wrote: »I would only class myself as a "Linux NOOB" and, as such, have had many a !!!!-up to sort out. It seems to me that you are going the long way round an easy problem. What I would do, as already been suggested to you previously, is take out your hard drive, buy a USB to SATA cable for a couple of quid and install this FREE utility on your Windows OS http://sourceforge.net/projects/ext2read/ and you'll be able to see everything on your HDD. If you have deleted your files, use another FREE utility Recuva to restore http://www.piriform.com/recuva.
Does recuva recover linux formatted files then ? I am glad that you pointed that out thank you
Edited: Just wish to clear up something , do you know how recuva works , and also how ext3fs works? Anyhow, pauls if we get to the need of removing the disk , I would suggest using a linux system or at least a live linux cd eg systemrescuecd. Sorry I too need to sleep.4.8kWp 12x400W Longhi 9.6 kWh battery Giv-hy 5.0 Inverter, WSW facing Essex . Aint no sunshine ☀️ Octopus gas fixed dec 24 @ 5.74 tracker again+ Octopus Intelligent Flux leccy0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 352.1K Banking & Borrowing
- 253.6K Reduce Debt & Boost Income
- 454.2K Spending & Discounts
- 245.2K Work, Benefits & Business
- 600.8K Mortgages, Homes & Bills
- 177.5K Life & Family
- 259K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards
