25.02.2021 17:14, Golota S.V. пишет:
Very thanks Nic it really helped. I find it hard to write scripts
25.02.2021 17:00, Nick Couchman пишет:
On Thu, Feb 25, 2021 at 2:01 AM Golota S.V.
<sgol...@turgai.kz.invalid> wrote:
>
>
> Hello!! made a script for automatic conversion of recording
sessions,
> the script itself works, but if you run it through cron, the line
> linked to the conversion does not work, I think the matter is
in the
> absence of the output parameter of the guacenc utility file.
tell me
> how to fix it.
>
Do you get a specific error?
>
> ++++++++++++++++++++++++++++++++++
>
> #!/usr/bin/bash
> guacenc -s 1024x768 /mnt/nfs-32/stream/web-app/tmp/*
> mv /mnt/nfs-32/stream/web-app/tmp/*.m4v /mnt/nfs-32/stream/web-app
> rm -r /mnt/nfs-32/stream/web-app/tmp
> mkdir /mnt/nfs-32/stream/web-app/tmp
>
> ++++++++++++++++++++++++++++++++++
>
Two things I see, here:
1) Often times when scripts are run out of cron, the PATH variable
does not necessarily contain all the values it would for "normal"
users. So, you might try specifying the full path to the guacenc
utility, or set the path at the top of the script.
2) Relying on wildcards can be a bit dangerous and unpredictable. I'd
recommend rewriting this script using a bash for loop. Something like
this:
==
#!/usr/bin/bash
for file in $(/usr/bin/find /mnt/nfs-32/stream/web-app/tmp -type f); do
/usr/local/bin/guacenc -s 1024x768 ${file}
/usr/bin/mv ${file}.m4v /mnt/nfs-32/stream/web-app
/usr/bin/rm -f ${file}
done
==
Note that I have not tested the above script at all - it likely has
some errors in it, but should be a good starting point. It also may
not be the best or only answer to it, just my humble suggestion.
-Nick
--