0

I've made a tool for backing up website files & DB. It works as expected if ran by any user. Usually it takes around a minute to run in my configuration. When I added it to the cron it starts but exits immediately. If the application experiences any error it loggs in stdout & in the log file, but in this case it logged none. Found following in /var/log/cron

Feb  8 20:43:01 test-server CROND[1522301]: (developer) CMD (/mnt/path/to/bin >> /mnt/path/to/exec.log)
Feb  8 20:43:02 test-server CROND[1522299]: (developer) CMDEND (/mnt/path/to/bin >> /mnt/path/to/exec.log)

The cron

# test cron
47 20 8 * * user /mnt/path/to/bin >> /mnt/path/to/exec.log 

Contents of /mnt/path/to/exec.log

[2024-02-08 20:47:01]  Starting backup

When it runs correctly it looks like following

[2024-02-07 20:13:11]  Starting backup
[2024-02-07 20:13:11] Processing server: 192.168.x.xxx
[2024-02-07 20:13:11] Processing project: 192.168.x.xxx:/path/in/remote/server
[2024-02-07 20:13:11] Processing project: 192.168.x.xxx:/another/path/in/remote/server
[2024-02-07 20:13:25] Processed project: 192.168.x.xxx:/path/in/remote/server
[2024-02-07 20:13:33] Processed project: 192.168.x.xxx:/another/path/in/remote/server
[2024-02-07 20:13:33] Processed server: 192.168.x.xxx
[2024-02-07 20:13:33] ✅ Backup completed

How this can be fixed, so the task gets ran correctly?

0 Answers0