Ensure Your Custom v-backup-users Still Exists if myVesta Updates Before Backup with a Cron Job
I’ve set up a way to ensure my custom v-backup-users script remains active before backups, even if myVesta updates overwrite it. This uses a cron job to restore the custom version 1 hour before the backup. Here’s a quick guide:
Step 1: Back Up Your Custom Script
Save your modified v-backup-users in a safe location:
Step 2: Create a Script to Restore Your Custom Version
Create /root/vesta-patch.sh to restore your custom script:
Add this content:
Save (Ctrl+O, Enter, Ctrl+X) and make it executable:
Step 3: Test the Script
Check if it updated correctly:
(No output means success.)
Step 4: Find Your Backup Schedule on your Vesta panel and set a Cron Job to Run 1 Hour Before Backup
Add a line to run /root/vesta-patch.sh 1 hour before the backup. For my case:
Save and verify:
--------------------------------------
if you ever decide to modify v-backup-users, update the copy:
I’ve set up a way to ensure my custom v-backup-users script remains active before backups, even if myVesta updates overwrite it. This uses a cron job to restore the custom version 1 hour before the backup. Here’s a quick guide:
Step 1: Back Up Your Custom Script
Save your modified v-backup-users in a safe location:
Code:
mkdir -p /root/myvesta-custom-scriptscp /usr/local/vesta/bin/v-backup-users /root/myvesta-custom-scripts/v-backup-users
Create /root/vesta-patch.sh to restore your custom script:
Code:
nano /root/vesta-patch.sh
Code:
#!/bin/bash# Check and replace if the script differsif ! cmp -s "/root/myvesta-custom-scripts/v-backup-users" "/usr/local/vesta/bin/v-backup-users"; then cp /root/myvesta-custom-scripts/v-backup-users /usr/local/vesta/bin/v-backup-users chmod 755 /usr/local/vesta/bin/v-backup-usersfi
Code:
chmod 755 /root/vesta-patch.sh
Step 3: Test the Script
Code:
/root/vesta-patch.sh
Code:
diff /usr/local/vesta/bin/v-backup-users /root/myvesta-custom-scripts/v-backup-users
Step 4: Find Your Backup Schedule on your Vesta panel and set a Cron Job to Run 1 Hour Before Backup
Code:
crontab -e
Code:
0 1 * * 7 /root/vesta-patch.sh
Code:
crontab -l
--------------------------------------
if you ever decide to modify v-backup-users, update the copy:
Code:
cp /usr/local/vesta/bin/v-backup-users /root/myvesta-custom-scripts/v-backup-users
Statistics: Posted by webxtek — Tue Mar 18, 2025 12:24 am