Incorporate Will's Awesome Stuff #1

Merged
merged 11 commits into from Mar 5, 2014

Conversation

Projects
None yet
2 participants
@phillcoxon
Owner

phillcoxon commented Mar 5, 2014

No description provided.

Will Ashworth added some commits Mar 4, 2014

Will Ashworth
Minor Improvements
- rename load watch script for cPanel to match README
Will Ashworth
Clean Up + Basic Enhancements
- added disk usage
- general comment clean-up
- organization of file
Will Ashworth
Auto-Delete logic
- added initial auto delete logic
- allows user to specify age before delete occurs
- does not touch the `checklog` file in any way
- removes `load watch.***` files older than specified age
@ashworthconsulting

This comment has been minimized.

Show comment Hide comment
@ashworthconsulting

ashworthconsulting Mar 5, 2014

Owner

Commented out the trip statement for now, allowing for testing to happen without high load on an actual server.

Commented out the trip statement for now, allowing for testing to happen without high load on an actual server.

This comment has been minimized.

Show comment Hide comment
@ashworthconsulting

ashworthconsulting Mar 5, 2014

Owner

Additional notes that didn't make it into the comments:

  • Also added seconds to the filename when created.
  • Auto-deletion has been tested and confirmed functioning.

If you'd like to test, just run the following command(s):

# trigger the script a few times so you have some files to actually delete
# sh /root/loadwatch/bin/loadwatch_cpanel.sh

# change the timestamp of the files you created to 2012
# touch -a -m -t 201201181205.09 /root/loadwatch/loadwatch.*

# run the script again, at which point your "old" files should be gone
# sh /root/loadwatch/bin/loadwatch_cpanel.sh

Additional notes that didn't make it into the comments:

  • Also added seconds to the filename when created.
  • Auto-deletion has been tested and confirmed functioning.

If you'd like to test, just run the following command(s):

# trigger the script a few times so you have some files to actually delete
# sh /root/loadwatch/bin/loadwatch_cpanel.sh

# change the timestamp of the files you created to 2012
# touch -a -m -t 201201181205.09 /root/loadwatch/loadwatch.*

# run the script again, at which point your "old" files should be gone
# sh /root/loadwatch/bin/loadwatch_cpanel.sh

Will Ashworth added some commits Mar 5, 2014

Will Ashworth
Major Changes
- restructured logic in large part
- added conditions to support parameters
- added `-x` or `--force` options added to allow you to force it to run (regardless of the current load threshold)
- added `-d` or `--dir` options added to allow you to override the $DIR variable
- added `-e` or `--email` options added to allow you to override the $EMAIL variable
- added `-f` or `--file` options added to allow you to override the $FILE variable
- added `-r` or `--remove` options added to allow you to override the $REMOVE variable, changing your `remove after x days` logic on the fly
- added `-t` or `--threshold` options added to allow you to override the $THRESH variable
- added `-h` or `--help` options, allowing help and usage information to display to the user
- various other clean-up
Will Ashworth
Bug Fix
- fixed high level if() statement syntax (it was off a bit)
Will Ashworth
Bug Fix
Still attempting to get this error to leave...

root@hostname [~/loadwatch]# sh bin/loadwatch_cpanel.sh
bin/loadwatch_cpanel.sh: line 68: [: missing `]'
bin/loadwatch_cpanel.sh: line 68: [: =: unary operator expected
Will Ashworth
Bug fix
- Another attempt
Will Ashworth
Bug Fix
- fixed if() statement finally (I think)
Will Ashworth
Bug fix
- fixed if() statement. it's tested and working now.

phillcoxon added a commit that referenced this pull request Mar 5, 2014

Merge pull request #1 from ashworthconsulting/master
Incorporate Will's Awesome Stuff

@phillcoxon phillcoxon merged commit 14b9d99 into phillcoxon:master Mar 5, 2014

phillcoxon pushed a commit that referenced this pull request Mar 6, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment