cat: stdout: No space left on device

Status
Not open for further replies.

icsy7867

Contributor
Joined
Dec 31, 2015
Messages
167
I was currently testing a script to email me some SMART information and I started getting this command

cat: stdout: No space left on device

I ran a df -h to check my space and I see:

Code:
Filesystem                                                  Size    Used   Avail                                                                                                                                                              Capacity  Mounted on
freenas-boot/ROOT/FreeNAS-9.3-STABLE-201602031011            27G    527M     26G                                                                                                                                                                  2%    /
devfs                                                       1.0k    1.0k      0B                                                                                                                                                                100%    /dev
tmpfs                                                        32M    6.2M     25M                                                                                                                                                                 19%    /etc
tmpfs                                                       4.0M    8.0k      4M                                                                                                                                                                  0%    /mnt
tmpfs                                                       5.3G    4.5G    844M                                                                                                                                                                 84%    /var
freenas-boot/grub                                            26G    6.8M     26G          


Can someone see something that I cannot? Thanks!
 

Mirfster

Doesn't know what he's talking about
Joined
Oct 2, 2015
Messages
3,215

icsy7867

Contributor
Joined
Dec 31, 2015
Messages
167
Of course!
4x 1.5TB HD in Raidz1
16GB DDR3 ECC Memory
AMD FX-8120
8GB Flash drive.

I am using a modified Smart script that I found in another post:

Code:
#!/usr/local/bin/sh
#
# Place this in /mnt/pool/scripts
# Call: sh esmart.sh /dev/ada0
# switch1 is the drive to check (passed parameter)
switch1=$1

# This will use the characters after "/dev/" for the temp file names.
# Example: /dev/ada0 becomes coverada0 or cover0ada0 or cover1ada0
# This needs to be done to keep multiple jobs from using the same files.
drv=`echo $switch1 | cut -c6-`

# Variable just so we can add a note that the drive was asleep when the
# application started but is now awake.
c=0

# Process to run our check on the drive
chkdrive()
{
smartctl -H -n standby -l error ${switch1} > /var/cover0${drv}
}

chkdrive
while [ $? != "0" ]
do
# Pause the checking of the drive to about once a minute if the drive is not running.
  sleep 59
  c=1
  chkdrive
done

if [ $c -eq 1 ]
then
echo "THE DRIVE WAS ASLEEP AND JUST WOKE UP" >> /var/cover${drv}
fi

# These lines remove the automatic Branding lines
sed -e '1d' /var/cover0${drv} > /var/cover1${drv}
sed -e '1d' /var/cover1${drv} > /var/cover0${drv}
sed -e '1d' /var/cover0${drv} > /var/cover1${drv}
sed -e '1d' /var/cover1${drv} > /var/cover0${drv}

cat /var/cover0${drv} >> /var/cover${drv}

exit 0


I think cat all the results together to have simple "PASSED" messages in the email, and then delete any files that are used.

Code:
(
echo "To: email@name.net"
echo "Subject: SMART Drive Results for ${switch1}"
echo " "
) > /var/results

sh /mnt/Storage/scripts/smart.sh /dev/ada0
sh /mnt/Storage/scripts/smart.sh /dev/ada1
sh /mnt/Storage/scripts/smart.sh /dev/ada2
sh /mnt/Storage/scripts/smart.sh /dev/ada3

cat "/dev/ada0" >> /var/results
cat /var/coverada0 >> /var/results
cat /var/coverada1 >> /var/results
cat /var/coverada2 >> /var/results
cat /var/coverada3 >> /var/results

sendmail -t < /var/results

rm /var/results
find /var/cover* -exec rm -rf {} \;

exit 0


I believe all of the dummy and trash files are cleaned up after the second script.

I got an error message once when trying to load the web gui that said /tmp was out of space. I cleared out temp and rebooted, but the issue persists. I would also like to note that it was working fine. And even if I wasnt cleaning up after myself properly it would take a long time for these few lines of text to measure of to 1MB+

I also have reboot several times.

Thanks for your time!
 
Last edited:

icsy7867

Contributor
Joined
Dec 31, 2015
Messages
167
Actually poking around... it looks like CAT doesnt like this command:

cat "/dev/ada0" >> /var/results

Taking it out, everything runs just fine. It looks like I'm using cat wrong. I should be able to just echo this into the file. Sorry about that!
 
Status
Not open for further replies.
Top