Page 1 of 1

simple bash script not working right

Posted: Tue Apr 28, 2015 5:55 pm
by hevilp
Hi, I am using this script:

Code: Select all

#! /bin/sh
### BEGIN INIT INFO
# Provides:          Aufnahmescript
# Required-Start: $autofs
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Kurze Beschreibung
# Description:       Bechreibung
### END INIT INFO


#Switch case fuer den ersten Parameter
case "$1" in
    start)
                #Aktion wenn start aufgerufen wird
                datum=`date +%Y-%m-%d-%H-%M`
                raspivid -o /mnt/cam/$datum.h264 -t 0
        echo "Starte meinScript"
        ;;

    stop)
                #Aktion wenn stop aufgerufen wird
        killall raspivid
        echo "Stoppe meinScript"
        ;;

    restart)
                #Aktion wenn restart aufgerufen wird
                datum=`date +%Y-%m-%d-%H-%M`
                killall raspivid && raspivid -o /mnt/cam/$datum.h264 -t 0

        echo "Restarte meinScript"
        ;;
        *)
                #Default Aktion wenn start|stop|restart nicht passen
                echo "(start|stop|restart)"
                ;;
esac

exit 0
I want to start this script with the boot (as last).
The script is started, but the file is not saved.
The location, where I want the outputfile is mounted with autofs (nfs share)

The video is show, but there is no file written, why?
if I log in, stop and restart the script all is fine. Only with the boot up the file is not written like it should be.

Can u help me

Re: simple bash script not working right

Posted: Tue Apr 28, 2015 6:11 pm
by PeterO
What is mounted on /mnt ?
Can root write to it ?

PeterO

Re: simple bash script not working right

Posted: Tue Apr 28, 2015 6:12 pm
by hevilp
root can write, when i stop the it, and run it when the user "pi" is logged in, the file is written. -> the mount is succesfull