Help with bash script!

*nix specific usage questions
el_heffe80
New Cone
New Cone
Posts: 1
Joined: 23 Jan 2015 00:26

Help with bash script!

Postby el_heffe80 » 23 Jan 2015 00:38

I am trying to capture a picture from a wireless webcam at a specific interval (starting at 0600, every two hours until 2000). So I found this command that will capture an image when run from the command line (this is a headless server). Thing is, it throws up a bunch of stuff on the screen, like the image is being generated from letters and numbers in colors.
Anyways, when I put it in a script (pasted below) and run it same thing. Image is created, and renamed. When I run this same script through cron it fails. As a regular user it produces no errors, as root it fails because VLC doesn't like root. Anyways- is there a fix to this script? Thank you in advance.

Code: Select all

#!/bin/bash vlc -I dummy http://login:password@192.168.44.19/snapshot.cgi --video-filter scene --no-audio --scene-path /path/to/TimeLapse/Tree/ --scene-prefix image_prefix --scene-format png vlc://quit --run-time=1 --quiet DATE=$(date +"%F_%H%M") mv /path/to/TimeLapse/Tree/image_prefix00001.png /path/to/TimeLapse/Tree/$DATE.png
When it is run from the command line this is the output:

Code: Select all

VLC media player 2.1.4 Rincewind (revision 2.1.4-0-g2a072be) VLC media player 2.1.4 Rincewind Command Line Interface initialized. Type `help' for help. > Fontconfig warning: FcPattern object size does not accept value "0" Fontconfig warning: FcPattern object size does not accept value "0" commandline read: vlc commandline read: http://login:password@192.168.44.19/snapshot.cgi commandline read: --video-filter commandline read: scene commandline read: --no-audio commandline read: --scene-path commandline read: /path/to/TimeLapse/Tree/ commandline read: --scene-prefix commandline read: image_prefix commandline read: --scene-format commandline read: png commandline read: vlc://quit commandline read: --run-time=1 commandline read: --quiet ~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 1.2.10 |~~~~~~~~~~~~~~~~~~~~~~~~~~ (c) 2001-2008 The world wide DirectFB Open Source Community (c) 2000-2004 Convergence (integrated media) GmbH ---------------------------------------------------------------- (*) DirectFB/Core: Single Application Core. (2012-05-21 06:44) (*) Direct/Memcpy: Using Generic 64bit memcpy() (!) Direct/Util: opening '/dev/fb0' failed --> Permission denied (!) DirectFB/FBDev: Error opening framebuffer device! (!) DirectFB/FBDev: Use 'fbdev' option or set FRAMEBUFFER environment variable. (!) DirectFB/Core: Could not initialize 'system_core' core! --> Initialization error!
Mail from postfix localonly on run through cron:

Code: Select all

To: person@localhost Subject: Cron <person@localhost> /home/person/.local/bin/imageCapture.sh Content-Type: text/plain; charset=ANSI_X3.4-1968 X-Cron-Env: <SHELL=/bin/sh> X-Cron-Env: <HOME=/home/username> X-Cron-Env: <PATH=/usr/bin:/bin> X-Cron-Env: <LOGNAME=login> Message-Id: <20150122231104.76278A0F11@localhost> Date: Thu, 22 Jan 2015 18:11:04 -0500 (EST) Fontconfig warning: FcPattern object size does not accept value "0" Fontconfig warning: FcPattern object size does not accept value "0" commandline read: vlc commandline read: -I commandline read: dummy commandline read: http://login:password@192.168.44.19/snapshot.cgi commandline read: --video-filter commandline read: scene commandline read: --no-audio commandline read: --scene-path commandline read: /path/to/TimeLapse/Tree/ commandline read: --scene-prefix commandline read: image_prefix commandline read: --scene-format commandline read: png commandline read: vlc://quit commandline read: --run-time=1 commandline read: --quiet ~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 1.2.10 |~~~~~~~~~~~~~~~~~~~~~~~~~~ (c) 2001-2008 The world wide DirectFB Open Source Community (c) 2000-2004 Convergence (integrated media) GmbH ---------------------------------------------------------------- (*) DirectFB/Core: Single Application Core. (2012-05-21 06:44) (*) Direct/Memcpy: Using Generic 64bit memcpy() (!) Direct/Util: opening '/dev/fb0' failed --> Permission denied (!) DirectFB/FBDev: Error opening framebuffer device! (!) DirectFB/FBDev: Use 'fbdev' option or set FRAMEBUFFER environment variable. (!) DirectFB/Core: Could not initialize 'system_core' core! --> Initialization error! Error opening terminal: unknown. mv: cannot stat ‘/path/to/TimeLapse/Tree/image_prefix00001.png’: No such file or directory
Anyways, whatever else you need, let me know. I have very little clue what I am doing, if it isn't already obvious. :D

nokangaroo
Blank Cone
Blank Cone
Posts: 29
Joined: 30 Dec 2010 17:11

Help with bash script!

Postby nokangaroo » 29 Jan 2015 13:25

Can you try prefixing your command with sudo -u <yourusername> ? That should run it as a normal user.


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 7 guests