Skip to content
This repository has been archived by the owner on Jan 9, 2020. It is now read-only.

Commit

Permalink
More Code Cleanup
Browse files Browse the repository at this point in the history
Modified README.md
  • Loading branch information
Ramorous committed Dec 1, 2015
1 parent 47485bc commit c5ca552
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ This module was tested and works great within RedHat Satellite 6.1.

Make sure touch is within the path /usr/bin or /sbin

The default command_var variable is set to "/sbin/shutdown -ra now" which will reboot your server. The intended purpose of this was originally to allow scheduled reboots, but I modified it to do more.

##Beginning with run once

```puppet
Expand Down
10 changes: 5 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@
$dt_current = regsubst(generate('/bin/date', '+%s'),'\n','')
$dt_start = regsubst(generate('/bin/date', '-d',$datetime_start,'+%s'),'\n','')
$dt_end = regsubst(generate('/bin/date', '-d',$datetime_end,'+%s'),'\n','')
$check_file = '${check_file_prefix}.${dt_start}'
$check_file = "${check_file_prefix}.${dt_start}"

# Check if Class is disabled (Helps to disable some hosts)
if $class_enabled == true {
# Check if Date/Time is within allowed period
if $dt_start <= $dt_current and $dt_end >= $dt_current {
# Prep Command that is to be run
$command_string = 'touch ${check_file};${command_var}'
exec { "scheduled_reboot_command":
$command_string = "touch ${check_file};${command_var}"
exec { 'scheduled_reboot_command':
command => $command_string,
user => root,
onlyif => '/usr/bin/test ! -f ${check_file}',
path => ['/usr/bin','/sbin'],
}
notice('Reboot command will run. ${command_string}')
notice("Reboot command will run. ${command_string}")
} else {
notice('Not the right time. Current Date/Time: ${dt_current}. Start Date/Time: ${dt_start}. End Date/Time: ${dt_end}.')
notice("Not the right time. Current Date/Time: ${dt_current}. Start Date/Time: ${dt_start}. End Date/Time: ${dt_end}.")
}
} else {
notice('Class disabled.')
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dependencies": [],
"license": "Apache-2.0",
"name": "Ramorous-scheduled_runonce",
"version": "0.1.15",
"version": "0.1.16",
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
Expand Down

0 comments on commit c5ca552

Please sign in to comment.