Cronicle
Cronicle copied to clipboard
No such file or directory (spawn /tmp/cronicle-script-temp-jlre950l608.sh ENOENT)
Summary
Cron job results in error: No such file or directory (spawn /tmp/cronicle-script-temp-jlre950l608.sh ENOENT)
Steps to reproduce the problem
1.Set up cron job 2. Paste in bash script 3. Save 4. Run 5. error
Your Setup
Operating system and version?
Ubuntu 22.04
Node.js version?
Cronicle software version?
Version 0.9.39
Are you using a multi-server setup, or just a single server?
single
Are you using the filesystem as back-end storage, or S3/Couchbase?
Can you reproduce the crash consistently?
Yes. Script run fine when trigged manually
#!/bin/bash
DB Container Backup Script Template
---
This backup script can be used to automatically backup databases in docker containers.
It currently supports mariadb, mysql and bitwardenrs containers.
DAYS=2 BACKUPDIR=/home/barkingb/backups
backup all mysql/mariadb containers
CONTAINER=$(docker ps --format '{{.Names}}:{{.Image}}' | grep 'mysql|mariadb' | cut -d":" -f1)
echo $CONTAINER
if [ ! -d $BACKUPDIR ]; then mkdir -p $BACKUPDIR fi
for i in $CONTAINER; do MYSQL_DATABASE=$(docker exec $i env | grep MYSQL_DATABASE |cut -d"=" -f2-) MYSQL_PWD=$(docker exec $i env | grep MYSQL_ROOT_PASSWORD |cut -d"=" -f2-)
docker exec -e MYSQL_DATABASE=$MYSQL_DATABASE -e MYSQL_PWD=$MYSQL_PWD \
$i /usr/bin/mysqldump -u root $MYSQL_DATABASE \
| gzip > $BACKUPDIR/$i-$MYSQL_DATABASE-$(date +"%Y%m%d%H%M").sql.gz
OLD_BACKUPS=$(ls -1 $BACKUPDIR/$i*.gz |wc -l)
if [ $OLD_BACKUPS -gt $DAYS ]; then
find $BACKUPDIR -name "$i*.gz" -daystart -mtime +$DAYS -delete
fi
done
echo "$TIMESTAMP Backup for Databases completed"
Log Excerpts
Job ID: jlre950l608
Event Title: Database-backup
Hostname: main
Date/Time: 2024/01/15 03:34:06 (GMT+2)
Job failed with error: Script failed: No such file or directory (spawn /tmp/cronicle-script-temp-jlre950l608.sh ENOENT)
2 retries remain
Job ID: jlre950l608
Event Title: Database-backup
Hostname: main
Date/Time: 2024/01/15 03:34:06 (GMT+2)
Job failed with error: Script failed: No such file or directory (spawn /tmp/cronicle-script-temp-jlre950l608.sh ENOENT)
1 retries remain
Job ID: jlre950l608
Event Title: Database-backup
Hostname: main
Date/Time: 2024/01/15 03:34:06 (GMT+2)
Job failed at 2024/01/15 03:34:06 (GMT+2).
Error: Script failed: No such file or directory (spawn /tmp/cronicle-script-temp-jlre950l608.sh ENOENT)
End of log.
The problem is likely your Linux distro doesn't allow executable scripts in the /tmp directory. I think "hardened" Linux flavors have this restriction.
See this issue: https://github.com/jhuckaby/Cronicle/issues/133
Ok, thanks.
I added "TMPDIR" to environment variables with /home/barkingb/tmp but got Error: ENOENT: no such file or directory, open '/home/barkingb/tmp/cronicle-script-temp-jlreb3sjr04.sh'
I suppose I need to un-harden /tmp
Cheers.
Does /home/barkingb/tmp
exist? You'll have to pre-create it, and chmod it to 777
, like /tmp
is.
But yeah, unhardening /tmp
would probably work best.
Good luck!
I had created the tmp but had not chmod 777 it. It still does not work. Error: ENOENT: no such file or directory, open '/home/barkingb/tmp/cronicle-script-temp-jlree04cu03.sh'
I cannot find any info on how to unharden /tmp so I think I will look into doing a manual entry in crontab.
Thanks so much for your help!
Oh, how weird. I don't know anything about hardened Linux, so forgive my lack of knowledge here, but I wonder if it has something to do with traversing into your home directory. Maybe try something like /opt/cronicle/tmp
?
Error: ENOENT: no such file or directory, open '/opt/cronicle/tmp/cronicle-script-temp-jlreeulbo01.sh'
Wow, okay, I am at a loss. I have no idea how to solve this one. I'll re-open this issue, so others can see it.