Class: Lumberg::Cpanel::Cron

Inherits:
Base show all
Defined in:
lib/lumberg/cpanel/cron.rb

Instance Attribute Summary

Attributes inherited from Base

#api_username

Attributes inherited from Whm::Base

#server

Instance Method Summary collapse

Methods inherited from Base

api_module, #initialize, #perform_request

Methods inherited from Whm::Base

#initialize, #setup_server

Constructor Details

This class inherits a constructor from Lumberg::Cpanel::Base

Instance Method Details

#add(options = {}) ⇒ Object

Public: Add a cron job.

options - Hash options for API call params (default: {}):

:command - String command to execute.
:day     - String day value.
:hour    - String hour value.
:minute  - String minute value.
:month   - String month value.
:weekday - String weekday value.

Returns Hash API response.


49
50
51
52
53
# File 'lib/lumberg/cpanel/cron.rb', line 49

def add(options = {})
  perform_request({
    api_function: "add_line"
  }.merge(options))
end

#edit(options = {}) ⇒ Object

Public: Edit a crontab entry.

options - Hash options for API call params (default: {}):

:command       - String command to execute.
:day           - String day value.
:hour          - String hour value.
:minute        - String minute value.
:month         - String month value.
:weekday       - String weekday value.
:commandnumber - Integer Line of cron entry to edit (optional).
                 If not present, :linekey is required.
:linekey       - String Linekey for entry to edit (optional).
                 If not present, :commandnumber is required.

Returns Hash API response.


82
83
84
85
86
# File 'lib/lumberg/cpanel/cron.rb', line 82

def edit(options = {})
  perform_request({
    api_function: "edit_line"
  }.merge(options))
end

#email(options = {}) ⇒ Object

Public: Get the default cron notification email address.

options - Hash options for API call params (default: {})

Returns Hash API response.


21
22
23
24
25
# File 'lib/lumberg/cpanel/cron.rb', line 21

def email(options = {})
  perform_request({
    api_function: "get_email"
  }.merge(options))
end

#list(options = {}) ⇒ Object

Public: Get list of cron jobs.

options - Hash options for API call params (default: {})

Returns Hash API response.


32
33
34
35
36
# File 'lib/lumberg/cpanel/cron.rb', line 32

def list(options = {})
  perform_request({
    api_function: "listcron"
  }.merge(options))
end

#remove(options = {}) ⇒ Object

Public: Remove a cron job.

options - Hash options for API call params (default: {}):

:linekey - String linekey of the crontab entry to remove.

Returns Hash API response.


61
62
63
64
65
# File 'lib/lumberg/cpanel/cron.rb', line 61

def remove(options = {})
  perform_request({
    api_function: "remove_line"
  }.merge(options))
end

#set_email(options = {}) ⇒ Object

Public: Set default cron notification email address.

options - Hash options for API call params (default: {}):

:email - String email address to receive notifications.

Returns Hash API response.


10
11
12
13
14
# File 'lib/lumberg/cpanel/cron.rb', line 10

def set_email(options = {})
  perform_request({
    api_function: "set_email"
  }.merge(options))
end