[SOLVED] command exited with status: 1

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
GadgetChris
Posts: 10
Joined: Wed Mar 13, 2024 3:31 am
Location: GTA, ON, Canada

[SOLVED] command exited with status: 1

Post by GadgetChris »

I just upgraded to docker version 1.36.33 from 1.36.32 to see if this fixed my issue, but to no avail.

I have a folder:

Code: Select all

root@023c028759ee:/# ls -l /var/www/scripts/
total 8
-rwxrwxr-x 1 1000 1000 118 Mar 12 22:48 trigger.sh
-rwxrwxr-x 1 1000 1000  32 Mar 12 23:08 zm-approach
-rw-rw-r-- 1 1000 1000   0 Mar 11 00:37 zm-package
And I can manually run successfully:

Code: Select all

root@e59f8d6fac75:/# zmfilter.pl --filter "trigger approach"
03/12/24 23:08:37.748207 zmfilter[822468].INF [main:179] [Scanning for events using filter 'trigger approach']
03/12/24 23:08:37.873674 zmfilter[822468].INF [main:1061] [Executing '/var/www/scripts/trigger.sh zm-approach /data/events/2/2024-03-11/20345']
03/12/24 23:08:37.880845 zmfilter[822468].INF [main:1061] [Executing '/var/www/scripts/trigger.sh zm-approach /data/events/2/2024-03-11/20347']
The trigger script will just put the event data in a file within the script directory:

Code: Select all

root@023c028759ee:/# cat /var/www/scripts/trigger.sh 
#!/bin/bash
#--- create a trigger for host processing
#set -x
#source ~/.bash_trace

cd /var/www/scripts
echo $2 > $1
In my filter I define for action the command execution:

Code: Select all

Execute command on all matches[b]:[/b]
/var/www/scripts/trigger.sh zm-approach
in the logs I see:

Code: Select all

3/12/24, 11:58:43 PM EDT	zmfilter_6		529	ERR	Command '/var/www/scripts/trigger.sh zm-package /data/events/2/2024-03-12/20575' exited with status: 1
What does this error mean?
And how can I succeed in getting the file created...

( On the host I have scripts waiting to further take action on the creation of this file...)

Thank you, Chris

p.s. Why can I not enter a colon in the text?
Last edited by GadgetChris on Sat Mar 16, 2024 5:31 pm, edited 2 times in total.
zm-v1.36.33 in docker @ Ubuntu 22.04.4.LTS
dougmccrary
Posts: 1215
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: command exited with status: 1

Post by dougmccrary »

Can www-data use those? Looks like they're root.
User avatar
iconnor
Posts: 2904
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: command exited with status: 1

Post by iconnor »

Your script has to get return a value of 0 for success. You don't explicitly set a return value, so it will be whatever the return value of the last line is. In the case echo $2 > $1?
GadgetChris
Posts: 10
Joined: Wed Mar 13, 2024 3:31 am
Location: GTA, ON, Canada

Re: command exited with status: 1

Post by GadgetChris »

iconnor wrote: Wed Mar 13, 2024 1:19 pm Your script has to get return a value of 0 for success. You don't explicitly set a return value, so it will be whatever the return value of the last line is.
Thank you, that makes sense.

I'm still not sure it's working, due to filled up logs. Will open a separate thread for that.
zm-v1.36.33 in docker @ Ubuntu 22.04.4.LTS
GadgetChris
Posts: 10
Joined: Wed Mar 13, 2024 3:31 am
Location: GTA, ON, Canada

Re: [SOLVED] command exited with status: 1

Post by GadgetChris »

While running in a docker container, there is no syslog logs to check for permission failures - that I have found thus far.
After explicitly setting the owner to www-data the trigger started to fire:

Code: Select all

root@023c028759ee:/# chown www-data /var/www/scripts/*
root@023c028759ee:/# ls -l /var/www/scripts/
total 12
-rwxrwxr-x 1 www-data 1000 125 Mar 13 10:50 trigger.sh
-rwxrwxr-x 1 www-data 1000  32 Mar 12 23:08 zm-approach
-rw-rw-r-- 1 www-data 1000  32 Mar 16 09:48 zm-package
Thank you for your help.
:D
zm-v1.36.33 in docker @ Ubuntu 22.04.4.LTS
Post Reply