Skip to content

Set default PATH for cron or full path to backup executable? #16

@allaire

Description

@allaire

Currently, the default command ran by the cron is root backup perform --trigger my_backup --config-file /etc/backup/config.rb --log-path=/var/log > /dev/nu$

Thing is, this fail miserably because the PATH in a cron is not the same as the PATH in our shell, and the backup command is not found.

I see two solutions here:

  • Use the full backup path, i.e /usr/local/bin/backup
  • Add a default PATH in the crond resource, i.e :path => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin'

My current solution is to set the path in the cron_options parameters, i.e

  cron_options({
    :path => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin',
    :mailto => 'dev@lodgem.com'
  })

But this is not really straightforward, since without this, the backup-cookbook cron simply does not work :)

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions