You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I installed SFTPgo using docker image v2 (and postgresql) and managed to setup a WebDAV endpoint. Using WebAdmin, I created a new user and using WebClient for that user, I added a few files to my WebDAV storage. Now I want to be able to take a backup for my WebDAV added files from the container path location and save in a tar ball.
I figured out that I can create an Event Manager Action Command with a tar command like:
Name: tst-compress
Command: /usr/bin/tar
Arguments: --zstd,-cf,"$BKUP_DIR/bkup-$(date '+%Y-%m-%d').tar.zst",-C,{{VirtualDirPath}},.
Environment Variables: BKUP_DIR: /srv/sftpgo/backups/{{VirtualDirPath}}
where {{VirtualDirPath}} placeholder is expected to be the username of the WebDAV storage -- same as WebClient username.
to be able to execute this command: tar --zstd -cf "/srv/sftpgo/backups/username/bkup-$(date '+%Y-%m-%d').tar.zst" -C /username .
-C /username is supposed to be a relative path with the full path being: /srv/sftpgo/data/username
In my docker-compose.yml, I also added another environment variable for my container: SFTPGO_COMMON__EVENT_MANAGER__ENABLED_COMMANDS: "/usr/bin/tar"
Event Manager Rule Schedule
Name: Compress backup
However, I am getting an error when executing the Event Manager Rule Schedule (I turned on debugging to a file):
{"level":"debug","time":"2024-11-18T20:00:00.007","sender":"eventmanager","message":"executing scheduled rule \"Compress backup\""}
{"level":"debug","time":"2024-11-18T20:00:00.034","sender":"eventmanager","message":"executed command \"/usr/bin/tar\", elapsed: 13.088265ms, error: exit status 2"}
{"level":"error","time":"2024-11-18T20:00:00.034","sender":"eventmanager","message":"unable to execute action \"tst-compress\" for rule \"Compress backup\", elapsed 13.55974ms, err: action \"tst-compress\" failed: exit status 2"}
{"level":"debug","time":"2024-11-18T20:00:00.034","sender":"eventmanager","message":"execution for scheduled rule \"Compress backup\" finished"}
Tar command has an exit status 2
Is there a problem with the placeholder {{VirtualDirPath}}?
Is it possible to log the full command that is being executed on the sftpgo.log file (with placeholders and env vars expanded)?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I installed SFTPgo using docker image v2 (and postgresql) and managed to setup a WebDAV endpoint. Using WebAdmin, I created a new user and using WebClient for that user, I added a few files to my WebDAV storage. Now I want to be able to take a backup for my WebDAV added files from the container path location and save in a tar ball.
I figured out that I can create an Event Manager Action Command with a tar command like:
Name:
tst-compress
Command:
/usr/bin/tar
Arguments:
--zstd,-cf,"$BKUP_DIR/bkup-$(date '+%Y-%m-%d').tar.zst",-C,{{VirtualDirPath}},.
Environment Variables:
BKUP_DIR
:/srv/sftpgo/backups/{{VirtualDirPath}}
where
{{VirtualDirPath}}
placeholder is expected to be theusername
of the WebDAV storage -- same as WebClient username.to be able to execute this command:
tar --zstd -cf "/srv/sftpgo/backups/username/bkup-$(date '+%Y-%m-%d').tar.zst" -C /username .
-C /username
is supposed to be a relative path with the full path being:/srv/sftpgo/data/username
In my
docker-compose.yml
, I also added another environment variable for my container:SFTPGO_COMMON__EVENT_MANAGER__ENABLED_COMMANDS: "/usr/bin/tar"
Event Manager Rule Schedule
Name:
Compress backup
However, I am getting an error when executing the Event Manager Rule Schedule (I turned on debugging to a file):
Tar command has an exit status 2
Is there a problem with the placeholder
{{VirtualDirPath}}
?Is it possible to log the full command that is being executed on the
sftpgo.log
file (with placeholders and env vars expanded)?Beta Was this translation helpful? Give feedback.
All reactions