Support intro
Hey there I was trying to automate overlaying a PDF with another file if it was placed in a special folder. Therefore I have created a bash script which should be triggered if a new File is created and has a special tag.
Seems like the condition is met but only if the Tag is modified manually or the file is modified manually my script gets executed.
Nextcloud version (eg, 20.0.5): 26.0.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.52
PHP version (eg, 7.4): 8.0
The issue you are facing:
Is this the first time you’ve seen this error? (Y/N): N
Steps to replicate it:
- Upload file to directory
- Use automated tagging to tag all PDF Files in a specific directory (this works as expected)
- Use Workflow Script to run a bash script if a file was created and tagged with this tag (from 1)
The script I try to execute is located under /usr/local/bin/ and owned by www-data. The executable flag was set using sudo chmod +x /usr/local/bin/pdf_overlay.sh
.
This is the script:
#!/bin/bash
exec 2>> /var/log/nextcloud/pdf_overlay.log
set -x
nextcloudpath=PathToNextcloudDataDirectory
filepath=$nextcloudpath$1
overlay=$nextcloudpath$2/files/flow/overlay.pdf
outputpath=/tmp/pdftk/
filename=$(basename "$filepath")
mkdir -p "$outputpath"
pdftk "$filepath" background "$overlay" output "$outputpath$filename"
mv "$outputpath$filename" "$filepath"
php /var/www/nextcloud/occ files:scan --path="$filepath" &> /dev/null
This is how I configured the flow:
I would expect the flow to be triggered every time a File was uploaded and tagged by automated tagging.
If I remove the tag manually and readd it everything works just fine.
This is the activity Tab of the uploaded file:
The output of your Nextcloud log in Admin > Logging:
This is the only part regarding workflow scripts
{
"reqId": "kXqJxXjVXiJ8Yc9YMnAB",
"level": 0,
"time": "2023-06-14T09:41:43+00:00",
"remoteAddr": "externalIP",
"user": "Lukas",
"app": "workflowengine",
"method": "POST",
"url": "/remote.php/dav/bulk",
"message": "Cannot handle event \\OCP\\Files::postCreate of OC\\EventDispatcher\\GenericEventWrapper against entity OCA\\WorkflowEngine\\Entity\\File and operation OCA\\WorkflowScript\\Operation",
"userAgent": "Mozilla/5.0 (Linux) mirall/3.7.3git (Nextcloud, ubuntu-6.2.0-20-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)",
"version": "26.0.1.1",
"data": {
"app": "workflowengine"
}
}
The output of your config.php file in /path/to/nextcloud
(make sure you remove any identifiable information!):
<?php
$CONFIG = array (
'instanceid' => '',
'passwordsalt' => '',
'secret' => '',
'trusted_domains' =>
array (
0 => '',
1 => '',
2 => '',
),
'trusted_proxies' =>
array (
0 => '',
1 => '127.0.0.1',
2 => '::1',
3 => '',
),
'datadirectory' => '',
'overwrite.cli.url' => '',
'overwriteprotocol' => 'https',
'htaccess.RewriteBase' => '/',
'dbtype' => 'mysql',
'version' => '26.0.1.1',
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'dbuser' => 'nextcloud',
'dbpassword' => '',
'logtimezone' => 'UTC',
'force_language' => 'de',
'default_phone_region' => 'DE',
'installed' => true,
'maintenance' => false,
'memcache.local' => '\\OC\\Memcache\\Redis',
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'filelocking.enabled' => 'true',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => '127.0.0.1',
'port' => '6379',
'password' => '',
'timeout' => 0.0,
),
'theme' => '',
'loglevel' => 0,
'mail_smtpmode' => 'smtp',
'mail_from_address' => '',
'mail_domain' => '',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtpauth' => 1,
'mail_smtpsecure' => 'tls',
'mail_smtphost' => '',
'mail_smtpport' => '',
'mail_smtpname' => '',
'mail_smtppassword' => '',
'filesystem_check_changes' => 1,
'updater.release.channel' => 'stable',
'trashbin_retention_obligation' => 30,
'mysql.utf8mb4' => true,
'app_install_overwrite' =>
array (
0 => 'keeweb',
1 => 'carnet',
2 => 'breezedark',
),
'has_rebuilt_cache' => true,
'preview_max_x' => '2048',
'preview_max_y' => '2048',
'jpeg_quality' => '60',
'enforce_theme' => '',
);
The output of your Apache/nginx/system log in /var/log/____
:
No errors logged.
Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.
No errors logged