Tuesday, August 18, 2015

Install jobber on CentOS 6.*


All the commands below are executed using root user
  1. Install go and git if you not already do so
  2. yum install go
    yum install git
  3. You need to specify workspace directory, this can be any path in your system. For this example, i use the following directory as the workspace - /home/amd/go
  4. Set the $GOPATH to this workspace directory
  5. export GOPATH=/home/amd/go
    
  6. Change directory to your workspace directory and run the following command to get the jobber files.
  7. go get github.com/dshearer/jobber
    
  8. As git supplied by CentOS 6 is version 1.7.1 and it cannot handle gopkg.in in package properly. If this is not down, you will encounter hang problem during compilation process. So you need to manually get the yaml.v2 package.
  9. git clone --branch v2 https://github.com/go-yaml/yaml $GOPATH/src/gopkg.in/yaml.v2
    
  10. Compile jobber package
  11. make -C src/github.com/dshearer/jobber
    
  12. Before proceed to next step, install daemonized if not already do so.
  13. yum install daemonize
    
  14. Install jobber
  15. make install -C src/github.com/dshearer/jobber
    
  16. Running the following command and you can see jobber service is running.
  17. service jobber status
    
  18. To create a scheduled job, you need to create .jobber file under user home directory. jobber file are written in YAML format.
  19.  ---
    - name: DailyBackup
      cmd: backup daily
      time: 0 0 13
      onError: Stop
      notifyOnError: false
      notifyOnFailure: true
    
  20. Once it is created, you need to load the job
  21.  /usr/local/bin/jobber reload
    
  22. You can check the log of the job using this command.
  23.  /usr/local/bin/jobber log
    

No comments: