Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michael S. Zick <minimod@morethan.org>
To: buildroot@busybox.net
Subject: [Buildroot] Strange behavior with shell redirection
Date: Fri, 18 Dec 2009 06:30:52 -0600	[thread overview]
Message-ID: <200912180630.54828.minimod@morethan.org> (raw)
In-Reply-To: <4B2B7141.90804@free.fr>

On Fri December 18 2009, Cyril HAENEL wrote:
> Hello all, sorry I don't know if I am in the good place to ask my 
> question...
> On an custom board based on the AT91SAM9260 processor, 
> buildroot-2009.05, and jffs2 as root file system, I have an "autostart" 
> script launched at board startup.
> In this script (I use the true bash and not the busybox shell) I launch 
> my application, and I redirect the output to a log file :
> 
> #!/bin/bash
> cd /home/potentiostat
> [...]
> echo "Launching application"
> ./potentiostatApplication >> /var/log/potentiostat
> # Reboot if application error
> if [ $? -ne 0 ]
> then
> reboot
> fi
> 
> I use ">>" for the redirection, thus normally each time this script is 
> launched it should concatenate the new log after the older one.
> But it's not the case, each time I startup the board I have a new log !!
> 
> I really don't understand this beahavior, any idea ?
> 

What is the implementation of that "reboot"?
Yours?  Something else?

It is very common that "reboot" does just exactly that, reboots.
No file sync, no file closing, nothing but reboot.

Try syncing the filesystem and unmounting it before rebooting.
mount -o remount <no options> <device name>
will flush the VFS buffers to disk if you don't have a "sync" available.
umount <device name> 
often does not flush/sync the file system, it depends on the FS.
So use both of the above commands - 

As to your first question -
Correct, wrong list; try a linux newbee forum.

Mike

> Best Regards,
> Cyril HAENEL
> 

  reply	other threads:[~2009-12-18 12:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-18 12:10 [Buildroot] Strange behavior with shell redirection Cyril HAENEL
2009-12-18 12:30 ` Michael S. Zick [this message]
2009-12-18 13:37   ` Cyril HAENEL
2009-12-18 14:19     ` Michael S. Zick
2009-12-18 18:03 ` Thomas Petazzoni
2009-12-18 19:30   ` Cyril HAENEL
2009-12-18 20:31     ` Michael S. Zick
2009-12-18 23:13       ` Cyril HAENEL

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200912180630.54828.minimod@morethan.org \
    --to=minimod@morethan.org \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox