Skip to content
Edtigoza edited this page Jul 10, 2016 · 2 revisions

### Working in a cronjob

 # to work with cronjobs using
 # drive command_here /mountpoint/  usually not work in all distribution
 # but if y you add the path it work
 # find your $GOPATH (drive installation folder is there) 
 
  $ which drive          #  use this command to find drive path 
  /var/go/bin/drive      #  => example $GOPATH folder installation or try with 
 
  $ cd $GOPATH
  $ pwd
  
  example in script with log
  ___________________________________________________________________________________

  #!/bin/bash
  {
  export DATE=`date +%Y-%m-%d_%H_%M`
  tar -cvzf /mnt/drive/path of your drive/backup_example_$DATE.tar.gz --exclude=FolderExample /example_your_mountpoint_here/

  /your_$GOPATH/bin/drive push -quiet /your_mountpoint_here/
  /your_$GOPATH/bin/drive emptytrash -quiet /your_mountpoint_here/

  } 2>&1 | tee /var/log/cron/backup.log
  ___________________________________________________________________________________
  
  #EXAMPLE $GOPATH in folder /var/go/
  
  #!/bin/bash
  /var/go/bin/drive push -quiet /your_mountpoint_here/ &&
  /var/go/bin/drive emptytrash -quiet /your_mountpoint_here/
 
  #for found more options use
  $ drive man