Welcome! Log In Create A New Profile

Advanced

Strange Observation & One Question

Posted by darethehair 
Strange Observation & One Question
April 10, 2011 08:08AM
This first one is more of an 'FYI' than an actual appeal for help :) My Debian Pogoplug is humming along just fine -- though I do run into the occasional weird behavior where strange things occur e.g. in one of my bash scripts, I have a line that contains a 'degree' symbol -- using 'vi' to edit that line goes crazy on my Pogoplug -- but on a normal Linux system it (of course) has no trouble. I had to edit the script externally and copy it to my Pogoplug in order to deal with this -- even the editor built into 'mc' did not work. Weird!

Next, I have some cron scripts running and doing work every minute -- and I have been trying to make sure that all the files that my own scripts create/change do so on the '/tmp' directory -- which is mapped to the 'tmpfs' file system (internal memory rather than storage). Can I be certain that NOT seeing the 'activity' light flash on my USB stick means that I am no long 'writing' to it -- and causing it to slowly wear out?
Re: Strange Observation & One Question
April 10, 2011 11:23AM
With regards to your first comment, I suspect your Pogoplug is using the wrong character set. (What exactly does "go crazy" mean?) Try echoing $LANG on both your desktop system and your Plug. I bet the Plug is set to "C" and the desktop to something like "en_US.utf8". If you need to edit files with special characters (those not in the ASCII character set) on your Plug, you might try loading the "vim" package. It provides a lot more flexibility over the base "vi".

I think you are correct with regard to your second point -- the flashing activity light on your USB stick -- although this is ultimately a function of the individual stick. Another thing you might try is
$ grep sda1 /proc/diskstats
(substituting the mounted partitions from your USB stick for "sda1". The output is:
Field 1 -- # of reads issued
Field 2 -- # of reads merged
Field 3 -- # of sectors read
Field 4 -- # of milliseconds spent reading
Field 5 -- # of writes completed
field 6 -- # of writes merged
Field 7 -- # of sectors written
Field 8 -- # of milliseconds spent writing
Field 9 -- # of I/Os currently in progress
Field 10 -- # of milliseconds spent doing I/Os
Field 11 -- weighted # of milliseconds spent doing I/Os
By comparing field 5 and field 7 from several invocations of the command, you can get an idea of how much write activity is occuring to that partition.
Re: Strange Observation & One Question
April 10, 2011 02:48PM
Thanks restamp! You are 100% correct on both points!
Re: Strange Observation & One Question
April 11, 2011 09:00AM
Ah, another strange behavior that I got caught on is due to my own sloppiness and laziness: some shell scripts that I had written worked fine when *I* ran them, but failed when *cron* did...

It turns out that the 'sh' shell (dash?) was being used by cron, but my own foreground sessions were using 'bash' (which is normal for me). I had to make sure that I added the typical '#!/bin/bash' at the top of my scripts to keep things consistent.
Re: Strange Observation & One Question
April 11, 2011 01:06PM
It's wise to always specify the shell in the script itself, as darethehair suggests, but if you want to always use a particular shell in cron, you can do this by specifying
SHELL=/bin/bash
as the first line of your crontab. (You can also specify "PATH=...", and/or other environment variables, at this point.)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: