user.callback error

Asked by avlas

I created my user.callback like this but it's not working, it keeps saying the folder cannot be found, I don't know why, so I would really appreciate your help:

!/bin/sh

report ()
{
    case $1 in
        #Application is not configured
        1) echo "Application is not configured" > /home/$user/backintime.log ;;
        #Take snapshot process is already running
        2) echo "Take snapshot process is already running" > /home/$user/backintime.log ;;
        #Can’t find snapshots directory
        3) echo "Can’t find snapshots directory" > /home/$user/backintime.log ;;
        #Snapshot for Now already exist
        4) echo "Snapshot for “now” already exist" > /home/$user/backintime.log ;;
    esac
}

proceed()
{
    case $1 in
        #Backup process begins.
        1) mkdir "/media/DriveName/"
           mount -t ext4 /dev/sdb1 "/media/DriveName/" ;;
        #Backup process ends
        2) sync
           umount "/media/DriveName/"
           rmdir "/media/DriveName/" ;;
        #There was an error
        4) report $2
           ;;
    esac
}

case $2 in
    #Profile Name
    BackupName)
                echo "Proceeding with BackupName" > /home/$user/backintime.log
                proceed $3 $4
                ;;
esac

Question information

Language:
English Edit question
Status:
Solved
For:
Back In Time Edit question
Assignee:
No assignee Edit question
Solved by:
avlas
Solved:
Last query:
Last reply:
Revision history for this message
Dan (danleweb) said :
#1

Does your snapshot folder is set to "/media/DriveName" ?

Revision history for this message
avlas (avlas) said :
#2

yes, those categorical names above (DriveName and $user) are exactly the same in config and in user.callback. If I keep user.callback and don't mount the drive manually, then no manual/automatic backup work because backintime doesn't find the folder. In change if I manually mount the drive (and I move user.callback to another name to avoid possible interferences), then it works perfectly. It seems to me that backintime is not calling user.callback before starting but instead starts, so the folder doesn't exist yet as the drive has not been mounted yet. could this be the case?

Revision history for this message
avlas (avlas) said :
#3

I meant BackupName and DriveName before better than $user, which is the place where I want to see the log file (it never appears, btw)

Revision history for this message
Dan (danleweb) said :
#4

Starting from BIT 1.0 the callback is called "user-callback" :)

Revision history for this message
avlas (avlas) said :
#5

oh my god, sorry about everything, I changed the name to user-callback and now it's working perfectly!!

By the way, let me recommend to put a couple of user-callback examples in the documentation for beginners. it took my a while to have it working, surely also because of the name thing ;)

Revision history for this message
Mike Higginbottom (navier1783) said :
#6

Worth noting that the parameters passed to user-callback have changed as well. See https://github.com/bit-team/user-callback for the updated docs and adjust this script accordingly.