Nextcloud - auto compress video via Workflow external script app

My setting script:

If file create and name matches /.*.mp4$/i

Script:

ffmpeg -i "$1" -c:v libx264 -crf 20 "$1"

Path to script:

/tmp/script.sh %n %o

I enter the command via terminal ssh:

snap run nextcloud.cron

I get a message

kaster/files/VIDEO/2023/04/example.mp4: Permission denied

What is wrong?

Never tried this myself.
Nextcloud runs under nextcloud user so try:

chown nextcloud.nextcloud /tmp/script.sh

Did not help. I get the same message.

When do you get this message?
Look at Settings - Logs or send us logs from Settings - Support (you can send logs to yourself only)

Message:


Logs

Apr 09 16:39:12 syncloud platform.backend[349]: info cli/executor.go:23 execute {"cmd": "/usr/bin/journalctl -n 1000 --no-pager"}

Apr 09 16:39:12 syncloud platform.backend[349]: info rest/middleware.go:71 GET: /rest/logs

Apr 09 16:39:07 syncloud nginx[635]: syncloud nginx: 185.186.16.56 - kadkarol [09/Apr/2023:16:39:07 +0000] "PROPFIND /remote.php/dav/files/kadkarol/KOPIA/YUPANA HTTP/1.1" 207 264 "-" "Mozilla/5.0 (Linux) mirall/3.4.2-1ubuntu1 (Nextcloud, neon-5.19.0-38-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)"

Apr 09 16:39:07 syncloud nginx[627]: syncloud nginx: 185.186.16.56 - kadkarol [09/Apr/2023:16:39:07 +0000] "PROPFIND /remote.php/dav/files/kadkarol/KOPIA/YUPANA HTTP/1.1" 207 264 "-" "Mozilla/5.0 (Linux) mirall/3.4.2-1ubuntu1 (Nextcloud, neon-5.19.0-38-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)"

Apr 09 16:39:07 syncloud nginx[635]: syncloud nginx: 185.186.16.56 - kadkarol [09/Apr/2023:16:39:07 +0000] "PROPFIND /remote.php/dav/files/kadkarol/KOPIA/WYDAWNICTWA HTTP/1.1" 207 268 "-" "Mozilla/5.0 (Linux) mirall/3.4.2-1ubuntu1 (Nextcloud, neon-5.19.0-38-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)"

Apr 09 16:39:07 syncloud nginx[627]: syncloud nginx: 185.186.16.56 - kadkarol [09/Apr/2023:16:39:07 +0000] "PROPFIND /remote.php/dav/files/kadkarol/KOPIA/WYDAWNICTWA HTTP/1.1" 207 268 "-" "Mozilla/5.0 (Linux) mirall/3.4.2-1ubuntu1 (Nextcloud, neon-5.19.0-38-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)"

Apr 09 16:39:07 syncloud slapd[655]: connection_read(10): no connection!

Apr 09 16:39:07 syncloud slapd[655]: conn=1030 fd=10 closed

Apr 09 16:39:07 syncloud slapd[655]: conn=1030 op=2 UNBIND

Apr 09 16:39:07 syncloud slapd[655]: conn=1031 fd=13 closed

Apr 09 16:39:07 syncloud slapd[655]: conn=1031 op=1 UNBIND

Apr 09 16:39:07 syncloud slapd[655]: conn=1031 op=0 RESULT tag=97 err=0 text=

Apr 09 16:39:07 syncloud slapd[655]: conn=1031 op=0 BIND dn="cn=kadkarol,ou=users,dc=syncloud,dc=org" mech=SIMPLE ssf=0

Apr 09 16:39:07 syncloud slapd[655]: conn=1031 op=0 BIND dn="cn=kadkarol,ou=users,dc=syncloud,dc=org" method=128

Apr 09 16:39:07 syncloud slapd[655]: conn=1031 fd=13 ACCEPT from IP=127.0.0.1:55714 (IP=127.0.0.1:389)

Apr 09 16:39:07 syncloud Nextcloud[1451]: {"reqId":"tL5apLo5DjJJgbB7katK","level":0,"time":"2023-04-09T16:39:07+00:00","remoteAddr":"185.186.16.56","user":"kadkarol","app":"user_ldap","method":"PROPFIND","url":"/remote.php/dav/files/kadkarol/KOPIA/WYDAWNICTWA","message":"Turned off SSL certificate validation successfully.","userAgent":"Mozilla/5.0 (Linux) mirall/3.4.2-1ubuntu1 (Nextcloud, neon-5.19.0-38-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:07 syncloud slapd[655]: conn=1030 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=

Apr 09 16:39:07 syncloud slapd[655]: <= mdb_equality_candidates: (cn) not indexed

Apr 09 16:39:07 syncloud slapd[655]: conn=1030 op=1 SRCH attr=entryuuid nsuniqueid objectguid guid ipauniqueid dn uid samaccountname memberof mail cn jpegphoto thumbnailphoto

Apr 09 16:39:07 syncloud slapd[655]: conn=1030 op=1 SRCH base="ou=users,dc=syncloud,dc=org" scope=2 deref=0 filter="(&(|(objectClass=inetOrgPerson))(cn=kadkarol))"

Apr 09 16:39:07 syncloud slapd[655]: conn=1030 op=0 RESULT tag=97 err=0 text=

Apr 09 16:39:07 syncloud Nextcloud[1451]: {"reqId":"tL5apLo5DjJJgbB7katK","level":0,"time":"2023-04-09T16:39:07+00:00","remoteAddr":"185.186.16.56","user":"kadkarol","app":"user_ldap","method":"PROPFIND","url":"/remote.php/dav/files/kadkarol/KOPIA/WYDAWNICTWA","message":"Ready for a paged search","userAgent":"Mozilla/5.0 (Linux) mirall/3.4.2-1ubuntu1 (Nextcloud, neon-5.19.0-38-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:07 syncloud Nextcloud[1451]: {"reqId":"tL5apLo5DjJJgbB7katK","level":0,"time":"2023-04-09T16:39:07+00:00","remoteAddr":"185.186.16.56","user":"kadkarol","app":"user_ldap","method":"PROPFIND","url":"/remote.php/dav/files/kadkarol/KOPIA/WYDAWNICTWA","message":"initializing paged search for filter (&(|(objectclass=inetOrgPerson))(cn=kadkarol)), base ou=users,dc=syncloud,dc=org, attr [\"entryuuid\",\"nsuniqueid\",\"objectguid\",\"guid\",\"ipauniqueid\",\"dn\",\"uid\",\"samaccountname\",\"memberof\",\"mail\",\"cn\",\"jpegphoto\",\"thumbnailphoto\"], limit 500, offset 0","userAgent":"Mozilla/5.0 (Linux) mirall/3.4.2-1ubuntu1 (Nextcloud, neon-5.19.0-38-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:07 syncloud slapd[655]: conn=1030 op=0 BIND dn="cn=admin,dc=syncloud,dc=org" mech=SIMPLE ssf=0

Apr 09 16:39:07 syncloud slapd[655]: conn=1030 op=0 BIND dn="cn=admin,dc=syncloud,dc=org" method=128

Apr 09 16:39:07 syncloud slapd[655]: conn=1030 fd=10 ACCEPT from IP=127.0.0.1:55708 (IP=127.0.0.1:389)

Apr 09 16:39:07 syncloud Nextcloud[1451]: {"reqId":"tL5apLo5DjJJgbB7katK","level":0,"time":"2023-04-09T16:39:07+00:00","remoteAddr":"185.186.16.56","user":"kadkarol","app":"user_ldap","method":"PROPFIND","url":"/remote.php/dav/files/kadkarol/KOPIA/WYDAWNICTWA","message":"Turned off SSL certificate validation successfully.","userAgent":"Mozilla/5.0 (Linux) mirall/3.4.2-1ubuntu1 (Nextcloud, neon-5.19.0-38-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:07 syncloud nginx[635]: syncloud nginx: 185.186.16.56 - kadkarol [09/Apr/2023:16:39:07 +0000] "PROPFIND /remote.php/dav/files/kadkarol/KOPIA/ISHIDO-SHIKI HTTP/1.1" 207 266 "-" "Mozilla/5.0 (Linux) mirall/3.4.2-1ubuntu1 (Nextcloud, neon-5.19.0-38-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)"

Apr 09 16:39:07 syncloud nginx[627]: syncloud nginx: 185.186.16.56 - kadkarol [09/Apr/2023:16:39:07 +0000] "PROPFIND /remote.php/dav/files/kadkarol/KOPIA/ISHIDO-SHIKI HTTP/1.1" 207 266 "-" "Mozilla/5.0 (Linux) mirall/3.4.2-1ubuntu1 (Nextcloud, neon-5.19.0-38-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)"

Apr 09 16:39:06 syncloud sudo[1944]: pam_unix(sudo:session): session closed for user nextcloud

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 fd=10 closed

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=7 UNBIND

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\WorkflowScript\\BackgroundJobs\\Launcher job with ID 2917 in 0 seconds","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":1,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"workflow_script","method":"","url":"--","message":"executing sh -c '/tmp/script.sh '\\''kadkarol/files/FOTO/WIDEO/2023/04/2_rece_2_mokuru.mp4'\\'' '\\''kadkarol'\\''' >/dev/null &","userAgent":"--","version":"25.0.2.3","data":{"app":"workflow_script"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\WorkflowScript\\BackgroundJobs\\Launcher job with ID 2917","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 2917","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OC\\Command\\CommandJob job with ID 2916 in 0 seconds","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=6 SEARCH RESULT tag=101 err=0 nentries=1 text=

Apr 09 16:39:06 syncloud slapd[655]: <= mdb_equality_candidates: (memberUid) not indexed

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=6 SRCH attr=memberuid cn dn

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=6 SRCH base="ou=groups,dc=syncloud,dc=org" scope=2 deref=0 filter="(&(memberUid=kadkarol)(&(|(objectClass=posixGroup))))"

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"Ready for a paged search","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"initializing paged search for filter (&(memberUid=kadkarol)(&(|(objectclass=posixGroup)))), base ou=groups,dc=syncloud,dc=org, attr [\"memberuid\",\"cn\",\"dn\"], limit 500, offset 0","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=5 SEARCH RESULT tag=101 err=0 nentries=1 text=

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=5 SRCH attr=uid

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=5 SRCH base="cn=kadkarol,ou=users,dc=syncloud,dc=org" scope=0 deref=0 filter="(objectClass=*)"

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"Ready for a paged search","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"initializing paged search for filter objectClass=*, base cn=kadkarol,ou=users,dc=syncloud,dc=org, attr [\"uid\"], limit 500, offset 0","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=4 SEARCH RESULT tag=101 err=0 nentries=0 text=

Apr 09 16:39:06 syncloud slapd[655]: <= mdb_equality_candidates: (gidNumber) not indexed

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=4 SRCH attr=dn

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=4 SRCH base="ou=groups,dc=syncloud,dc=org" scope=2 deref=0 filter="(&(&(|(objectClass=posixGroup)))(objectClass=posixGroup)(gidNumber=10))"

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"Ready for a paged search","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"initializing paged search for filter (&(&(|(objectclass=posixGroup)))(objectClass=posixGroup)(gidNumber=10)), base ou=groups,dc=syncloud,dc=org, attr [\"dn\"], limit 1, offset 0","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=3 SEARCH RESULT tag=101 err=0 nentries=1 text=

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=3 SRCH attr=gidnumber

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=3 SRCH base="cn=kadkarol,ou=users,dc=syncloud,dc=org" scope=0 deref=0 filter="(objectClass=*)"

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"Ready for a paged search","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"initializing paged search for filter objectClass=*, base cn=kadkarol,ou=users,dc=syncloud,dc=org, attr [\"gidnumber\"], limit 500, offset 0","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"Requested attribute primarygroupid not found for cn=kadkarol,ou=users,dc=syncloud,dc=org","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=2 SEARCH RESULT tag=101 err=0 nentries=1 text=

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=2 SRCH attr=primarygroupid

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=2 SRCH base="cn=kadkarol,ou=users,dc=syncloud,dc=org" scope=0 deref=0 filter="(objectClass=*)"

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"Ready for a paged search","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"initializing paged search for filter objectClass=*, base cn=kadkarol,ou=users,dc=syncloud,dc=org, attr [\"primarygroupid\"], limit 500, offset 0","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"readAttribute: cn=kadkarol,ou=users,dc=syncloud,dc=org found","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=1 SRCH attr=1.1

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=1 SRCH base="cn=kadkarol,ou=users,dc=syncloud,dc=org" scope=0 deref=0 filter="(|(objectClass=inetOrgPerson))"

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"Ready for a paged search","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"initializing paged search for filter (|(objectclass=inetOrgPerson)), base cn=kadkarol,ou=users,dc=syncloud,dc=org, attr [\"\"], limit 500, offset 0","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=0 RESULT tag=97 err=0 text=

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=0 BIND dn="cn=admin,dc=syncloud,dc=org" mech=SIMPLE ssf=0

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 op=0 BIND dn="cn=admin,dc=syncloud,dc=org" method=128

Apr 09 16:39:06 syncloud slapd[655]: conn=1029 fd=10 ACCEPT from IP=127.0.0.1:55706 (IP=127.0.0.1:389)

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"Turned off SSL certificate validation successfully.","userAgent":"--","version":"25.0.2.3","data":{"app":"user_ldap"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OC\\Command\\CommandJob job with ID 2916","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 2916","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 13","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 20","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 10","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 19","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 2914","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:06 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:06+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 30","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 14","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 39","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 5","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 29","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 16","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 23","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 2","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 6","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 18","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 33","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 40","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 17","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 21","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 7","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\Notifications\\BackgroundJob\\SendNotificationMails job with ID 24 in 0 seconds","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\Notifications\\BackgroundJob\\SendNotificationMails job with ID 24","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 24","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 2851","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 25","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 9","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 3","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 27","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 35","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 8","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 12","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 34","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\Activity\\BackgroundJob\\EmailNotification job with ID 1 in 0 seconds","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\Activity\\BackgroundJob\\EmailNotification job with ID 1","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 1","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 15","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 32","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OC\\Log\\Rotate job with ID 31 in 0 seconds","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OC\\Log\\Rotate job with ID 31","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:05 syncloud Nextcloud[1955]: {"reqId":"vf4gydYafpl44qKchrsh","level":0,"time":"2023-04-09T16:39:05+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 31","userAgent":"--","version":"25.0.2.3","data":{"app":"cron"}}

Apr 09 16:39:03 syncloud sudo[1944]: pam_unix(sudo:session): session opened for user nextcloud by root(uid=0)

Apr 09 16:39:03 syncloud sudo[1944]: root : TTY=pts/0 ; PWD=/root ; USER=nextcloud ; COMMAND=/snap/nextcloud/676/bin/php.sh -f /snap/nextcloud/676/nextcloud/cron.php

Sorry what is the exact command you are running and where did you get this command from?

You are showing ffmpeg version ... which does not make sense.

Also you are running this command as root.

What are you truing to achieve and what is the documentation you trying to read it in?

Command is:

ffmpeg -i "$1" -c:v libx264 -crf 2- "$1"

When I invoke this command in terminal giving instead “$1” the name of a specific file, it works. The appearance of the ffmpeg version is standard. The problem is when it is called in nextcloud.

Changing the owner of the file with the command:

chown nextcloud.nextcloud /tmp/script.sh

changes nothing.

You probably already corrupted permissions inside data dir by running ffmpeg under root or by copying files there under root.

Try showing the permissions on the dir and on the file, like

ls -la /data/nextcloud/kaster/files/VIDEO/2023/04/example.mp4

ls -la /data/nextcloud/kaster/files/VIDEO/2023/04

You seem to ignore my other questions (this is not helping you)

Running any command under root changes permissions of files so nextcloud eill not be able to read/write them. So I assume you know what you are doing.

I did not modify the content of files in nextcloud in the terminal. The attempt I wrote about above was made by placing the example.mp4 file in the /tmp directory

Here are the results of the ls commands:

ls -la /data/nextcloud/kaster/files/FOTO/WIDEO/2023/04

total 2517564
drwxr-xr-x 1 nextcloud nextcloud 46 Apr 10 16:01 .
drwxr-xr-x 1 nextcloud nextcloud 4 Apr 6 19:48 …
-rw-r–r-- 1 nextcloud nextcloud 2504549 Apr 20 2020 example.mp4
-rw-r–r-- 1 nextcloud nextcloud 2575475710 Apr 1 11:22 konkurs2.mp4

ls -la /data/nextcloud/kaster/files/FOTO/WIDEO/2023/04/example.mp4

-rw-r–r-- 1 nextcloud nextcloud 2504549 Apr 20 2020 /data/nextcloud/kaster/files/FOTO/WIDEO/2023/04/example.mp4

Ok, so you are trying to use Nextcloud workflow_script app: GitHub - nextcloud/workflow_script: Rule based processing of files through specified external scripts

This is the actuall command from the log:

 executing sh -c '/tmp/script.sh '\\''kadkarol/files/FOTO/WIDEO/2023/04/2_rece_2_mokuru.mp4'\\'' '\\''kadkarol'\\''' >/dev/null &

Args:

  1. kadkarol/files/FOTO/WIDEO/2023/04/2_rece_2_mokuru.mp4
  2. kadkarol

Your script:

ffmpeg -i "$1" -c:v libx264 -crf 20 "$1"

Questions:

  1. You are not using second parameter, only first one twice, is this correct?
  2. Even if you were they seem to be relative paths, what do you expect your cwd to be when ran by nextcloud cron?

I expect a processed file with the same name as in the beginning.

How can I help?
Do you want me to help debugging your script?
Put more logs and see the output in the nextcloud.

Try to see current working directory echo $(pwd) for example.
kadkarol/files/FOTO/WIDEO/2023/04/2_rece_2_mokuru.mp4 is not absolute path, so it depends on your current directory.

Like with any script running it directly with one user is not the same as running using cron under another user.

That’s how it works. Thank you very much :grinning:.
Changing the working directory got this to work when I run cron.php manually. However, the tasker still does not execute when cron is run by nextcloud. I’ll investigate it.

Ok, my solution.

Setting Workflow external script:

When <FIle created> and file name <mathes> /.*.mp4$/i

Run script: /tmp/script.sh %n %o

My script.sh:

ffmpeg -i /data/nextcloud/"$1" -map_metadata 0 -vcodec h264 -acodec aac /data/nextcloud/"$1"_tmp.mp4
rm  /data/nextcloud/"$1"
mv /data/nextcloud/"$1"_tmp.mp4 /data/nextcloud/"$1"

snap run nextcloud.occ files:scan --path="$1"

Works great, mp4 file size decreases. However, there is another problem. After conversion, the creation date of the mp4 file is lost and as a result, in the Memories application (in Nextcloud), the mp4 file is incorrectly shown on the timeline. Maybe someone can suggest how to fix it.