filed
Job queue using FUSE
git clone git://mccd.space/filed
| Log | Files | Refs | README | LICENSE |
commit 30b1a5a401c23532f294dd4cac77278283d8b66f parent 1333a3fa73222ed3afdcfd46b43ee0e9bad2ad90 Author: Marc Coquand <marc@coquand.email> Date: Mon, 15 Dec 2025 15:37:24 +0100 Updates to docs Diffstat:
| M | README.md | | | 2 | +- |
| M | config.go | | | 2 | +- |
| M | main.go | | | 17 | +++++++++-------- |
| M | newid.go | | | 2 | +- |
| M | qj.1.scd | | | 14 | ++++++-------- |
5 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/README.md b/README.md
@@ -68,7 +68,7 @@ $ mv /tmp/qj-jobs/failed/1 /tmp/qj-jobs/pending
## TODO
- [x] Support chmod and chown
-- [ ] State is configured via environment variable
+- [x] State is configured via environment variable
- [ ] Customizable backoff and timeout before retries
- [ ] "Landlock"-mode, or sandboxed jobs
diff --git a/config.go b/config.go
@@ -72,7 +72,7 @@ func (f *ConfigFile) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp
}
func (f *ConfigFile) ReadAll(ctx context.Context) (jsonConf []byte, err error) {
- slog.Info("FUSE: Read file content")
+ slog.Debug("FUSE: Read file content")
config := f.manager.store.GetConfig()
jsonConf, err = json.Marshal(config)
if err != nil {
diff --git a/main.go b/main.go
@@ -5,7 +5,6 @@ import (
"context"
"flag"
"fmt"
- "log"
"log/slog"
"os"
"os/exec"
@@ -24,12 +23,6 @@ func usage() {
}
func main() {
- userUid := uint32(os.Getuid())
- if userUid == 0 {
- warning := fmt.Sprintf("Running %s as root is highly not recommended. Be careful", os.Args[0])
- slog.Warn(warning)
- }
-
flag.Usage = usage
flag.Parse()
@@ -41,11 +34,19 @@ func main() {
if dbPath == "" {
xdg_home := os.Getenv("XDG_DATA_HOME")
if xdg_home == "" {
- log.Fatal("QJ_DATA_FILE environment variable needs to be set.")
+ fmt.Fprintf(os.Stderr, "QJ_DATA_FILE environment variable needs to be set.\n")
+ usage()
+ os.Exit(1)
}
dbPath = fmt.Sprintf("%s/qj.db", xdg_home)
}
+ userUid := uint32(os.Getuid())
+ if userUid == 0 {
+ warning := fmt.Sprintf("Running %s as root is highly not recommended. Be careful", os.Args[0])
+ slog.Warn(warning)
+ }
+
mountpoint := flag.Arg(0)
if err := Unmount(mountpoint); err != nil {
slog.Debug("FUSE: Pre-start unmount failed (this is usually okay)", "error", err)
diff --git a/newid.go b/newid.go
@@ -75,6 +75,6 @@ func (f *NewIdFile) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp
}
func (f *NewIdFile) ReadAll(ctx context.Context) ([]byte, error) {
- slog.Info("FUSE: Read file content")
+ slog.Debug("FUSE: Read file content")
return randomJobId(f.manager.store, 4), nil
}
diff --git a/qj.1.scd b/qj.1.scd
@@ -63,19 +63,17 @@ exist. Defaults to $XDG_DATA_HOME/qj.db, or exit(1) if XDG_DATA_HOME is unset.
# EXAMPLES
-Create a new job with $JOBID that echoes hello world:
+Create a new job with a unique id, that echoes hello world:
- $ JOBID="$(cat /var/qj/new-id)"
+ $ printf "echo helloworld" > "/var/qj/pending/$(< /var/qj/new-id)"
- $ printf "echo helloworld" > "/var/qj/pending/$JOBID"
+Retry a failing job titled myjob:
-Retry a failing job titled E6Xe:
+ $ mv /var/qj/failed/myjob /var/qj/pending
- $ mv /var/qj/failed/E6Xe /var/qj/pending
+Inspect a currently running job:
-Inspect a currently running job titled E6Xe:
-
- $ cat /var/qj/active/E6Xe
+ $ cat /var/qj/active/myjob
Periodic jobs can be set up using _CRON(8)_.