Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Hydrohs

#1
24.7, 24.10 Legacy Series / Cron job with SCP
September 16, 2024, 02:41:17 AM
I'm trying to create a cron job to backup my config and scp it to my backup server. I have the following script:
#!/bin/sh
DATE=`date +%d-%m-%Y_%H.%M.%S`
/usr/bin/bsdtar zcvhf /root/config_${DATE}.tar.gz -C / conf/config.xml conf/backup/ root/backup.sh
/usr/local/bin/scp -q /root/config_${DATE}.tar.gz hydrohs@my-ip:/data/hydrohs/Backups/opnsense/
rm /root/config_${DATE}.tar.gz

Running this script on its own works no problem.

I have the following action file at /usr/local/opnsense/service/conf/actions.d/actions_scp-backup.conf
With contents
[run]
command:/usr/local/opnsense/scripts/system/scp_backup.sh
type:script_output
message:Backing up config files
description:Backup config files


But running this with configctl scp-backup run doesn't work (I have restarted configd), the archive does not get uploaded and I only get an entry like this is the configd log:

[meta sequenceId="2"] [1c3d7ecc-6dc6-4003-a1ec-a7b5ecfbe2ff] Script action stderr returned "b'a conf/config.xml\na conf/backup\na conf/backup/config-1726428985.1454.xml\na conf/backup/config-1726427955.1602.xml\na conf/backup/config-1726430341.1865.xml\na conf/backup/config-1726430899.0235.xml\na conf/backup/config-1726428942.926.xml\na conf/backup/confi'"

What am I missing?