jhuckaby / Cronicle

A simple, distributed task scheduler and runner with a web based UI.
http://cronicle.net
Other
3.91k stars 391 forks source link

Problem using advanced features of shell plugin on Ubuntu server #728

Open SprickW opened 8 months ago

SprickW commented 8 months ago

Summary

After fiddling around with tipps given in the wiki but finally not being successful I started from scratch.

My intent:

In a VM (not LXC) running Ubuntu 22.04 minimal server a regular user shall prepare and test scripts, that later shall bei executed bei Cronicle on a regular basis.

For this I cloned the shell plugin and used the advanced options and specified "Working Direktory (CWD)" and "Run as User (UID)" as home directory and uid of the intended regular user. I considered this as a feature offered by the advanced options.

When running a simple "whoami" I receive

Error: Child spawn error: bin/shell-plugin.js: Child process failed to spawn (Check executable location and permissions?)

In the docs I only found "Cronicle spawns a sub-process for each job, executes a command-line you specify, ..." but no further hints on how to use the advanced features of the shell plugin.

As "whoamin" should not cause excecution and permission problems I need further assistance.

Leaving "Working Direktory (CWD)" empty causes "whoami" to work properly.

But then trying to run a script installed by the user fails with "not found".

Steps to reproduce the problem

Copy shell plugin an use advanced features

Your Setup

Single primary Cronicle Server

Operating system and version?

Workers in LXC and VMs in Proxmox cluster, LXC and VM Ubuntu 22.04.3 LTS

Node.js version?

v20.11.1

Cronicle software version?

Version 0.9.30

Are you using a multi-server setup, or just a single server?

Single server.

Are you using the filesystem as back-end storage, or S3/Couchbase?

filesystem

Can you reproduce the crash consistently?

yes

Log Excerpts

Case 1 (working directory and uid specified)

Script:

!/bin/sh

whoami

Job ID: jlti5n5hf30 Event Title: maddev Test Hostname: maddev Date/Time: 2024/03/08 04:26:43 (GMT+0)

Job failed at 2024/03/08 04:26:43 (GMT+0). Error: Child spawn error: bin/shell-plugin.js: Child process failed to spawn (Check executable location and permissions?) End of log.

Case 2 (only uid specified)

!/bin/sh

whoami files-and-database --help

Job ID: jlti6eblq32 Event Title: maddev Test Hostname: maddev Date/Time: 2024/03/08 04:47:50 (GMT+0)

maddev /tmp/cronicle-script-temp-jlti6eblq32.sh: 3: files-and-database: not found

Job failed at 2024/03/08 04:47:50 (GMT+0). Error 127: Script exited with code: 127: /tmp/cronicle-script-temp-jlti6eblq32.sh: 3: files-and-database: not found End of log.

SprickW commented 8 months ago

Stupid me:

export PATH=$PATH:/home/maddev/.local/bin

solved the problem not finding the executable.

Which leaves the issues with what "Working Direktory (CWD)" is meant for.