Cron job bug with restic script?

I was wondering if there’s an issue with the cronjob or the restic version or the script im running
currently running

         restic 0.8.3 (v0.8.3-191-g6d4c40f8) compiled with go1.10 on linux/amd64

Currently if i run the script it works great but when i put it on the cronjob im getting email saying this and another email showing blank

      unknown shorthand flag: 'v' in -v
      Null message body; hope that's ok
       snapshots for host prometheus, directories /media/smb2:

This is the bash script


      export RESTIC_REPOSITORY=/media/backupsdaily
    export RESTIC_PASSWORD=mypass

    NOW=$( date '+%Y-%m-%d-%H-%M-%S' )
       restic backup -v -v /media/smb2 | /usr/bin/tee logfile-$now
        mail -r "<>" -s "Backup Successful" < logfile-$now
      restic forget --keep-last 10

if i take out the -v -v it works so im going on a limb and say that somewhere it still is using the old version (0.8.3 without the -191) of restic?

Thank you

Looking at " restic backup --help" I do not believe the -v is a valid command / options. Why do you believe “-v” should be possible?

Thanks for the reply im using the new version which was posted yesterday this is what i get when i run restic backup --help

  Global Flags:
         --cacert stringSlice       path to load root certificates from (default: use system certificates)
      --cache-dir string         set the cache directory
  --cleanup-cache            auto remove old cache directories
  --json                     set output mode to JSON for commands that support it
  --limit-download int       limits downloads to a maximum rate in KiB/s. (default: unlimited)
  --limit-upload int         limits uploads to a maximum rate in KiB/s. (default: unlimited)
  --no-cache                 do not use a local cache
  --no-lock                  do not lock the repo, this allows some operations on read-only repos
      -o, --option key=value         set extended option (key=value, can be specified multiple times)
      -p, --password-file string     read the repository password from a file (default: $RESTIC_PASSWORD_FILE)
    -q, --quiet                    do not output comprehensive progress report
 -r, --repo string              repository to backup to or restore from (default: $RESTIC_REPOSITORY)
  --tls-client-cert string   path to a file containing PEM encoded TLS client certificate and private key
   -v, --verbose n[=-1]           be verbose (specify --verbose multiple times or level n)

Thank you

Global flags have to be placed before the command. Try this:
restic -v -v backup /media/smb2

As @764287 said you have to place the global args outside the scope of the backup command, because backup doesn’t have any -v arguments. That means you can place it before or after the backup command, like so:

restic -v backup /my/path or restic backup /my/path -v, placing any backup arguments between backup and /my/path.

This is also explained in restic backup help:

  restic backup [flags] FILE/DIR [FILE/DIR] ...

  -e, --exclude pattern                  exclude a pattern (can be specified multiple times)
      --exclude-caches                   excludes cache directories that are marked with a CACHEDIR.TAG file
      --exclude-file file                read exclude patterns from a file (can be specified multiple times)
      --exclude-if-present stringArray   takes filename[:header], exclude contents of directories containing filename (except filename itself) if header of that file is as provided (can be specified multiple times)
      --files-from string                read the files to backup from file (can be combined with file args)
  -f, --force                            force re-reading the target files/directories (overrides the "parent" flag)
  -h, --help                             help for backup
      --hostname hostname                set the hostname for the snapshot manually. To prevent an expensive rescan use the "parent" flag
  -x, --one-file-system                  exclude other file systems
      --parent string                    use this parent snapshot (default: last snapshot in the repo that has the same target files/directories)
      --stdin                            read backup from stdin
      --stdin-filename string            file name to use when reading from stdin (default "stdin")
      --tag tag                          add a tag for the new snapshot (can be specified multiple times)
      --time string                      time of the backup (ex. '2012-11-01 22:08:41') (default: now)
      --with-atime                       store the atime for all files and directories

Note that [flags] doesn’t contain a -v argument.

Thanks for the replies, So i get an email but its blank, then i get a second email from cron daemon saying this, Whats odd is that if i run the script manually adding the -v -v after the backup it works but putting it on the cronjob it gets all wierd

           unknown command "/media/smb2" for "restic"
         Null message body; hope that's ok
       snapshots for host prometheus, directories /media/smb2:

     keep 6 snapshots:
    ID        Date                 Host        Tags        Directory
     b42eae31  2018-04-29 21:34:02  prometheus              /media/smb2
     e1214447  2018-04-29 21:25:59  prometheus              /media/smb2
   7645af8b  2018-04-29 21:23:58  prometheus              /media/smb2
     47e2ac70  2018-04-29 21:21:02  prometheus              /media/smb2
       b773d9c5  2018-04-29 21:18:03  prometheus              /media/smb2
      4db2818f  2018-04-29 21:17:02  prometheus              /media/smb2

    remove 0 snapshots:
  ID        Date                 Host        Tags        Directory

Thank you

FYI (don’t have much time right now): --verbose/-v was introduced in restic master as a global flag, it isn’t contained in any release yet.

Thanks for the reply, no worries i will keep trouble shooting the issue its just very odd that i run the script manually and it works no issues but when i crontab it, it wont work.

Thank you

Solution: Found out the issue i did have a feeling it was using the old version of restic for some odd reason so this is what i did to fix it

           /usr/local/bin/restic -v -v backup /media/smb2