-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(git): grr function to reset branch to remote origin 8732dbb feat(git): grr function to reset branch to remote origin a63795e fix(cpu): Added success color to cpu command 705eaed fix(zshbop): Changed file version to VERSION but didn't updated zshbop.zsh c05844e fix(sysinfo): Fixed sysinfo, mem and cpu and added to motd 3fa0b1c fix(mem): The command mem wasn't reporting total. c3a4433 style(mem): Fixed style on mem command 40955d3 refactor(zshbop): Created include.zsh for including the zshbop framework 6a24b5c feat(worpdress): Added wp-profile command to install wp-cli/profile-command eb668cd feat(software): Check if ncdu is installed, if not create function to install it b1e72e1 feat(software): Added php-relay to software command 4504f49 docs(php-relay): Created KB for php-relay and added litespeed install instructions 6f42686 enhance(php-relay): Addd more to php-relay.md KB 7727777 revert(gridpane): Removed gp-duplicacy-audit a139097 feat(softare): Software installation for latest goaccess 65ecc54 feat(scripts): Added script cron.sh for running crons c01a72d feat(git): Created git-squash-commits to git commit history cedec5b fix(git-squash-commit): Git log commands were all on one line, now properly formatted b3a6326 feat(scripts): Created cron.sh script for running cron 4ba5dc6 enhance(cronsh): Updated cron.sh with additional improvements 6c3d9d4 enhance(cronsh): Print out that heartbeat was sent and the URL bd698e0 fix(git-check): Logic in git-check-exit to be able to return to zsh shell
- Loading branch information
1 parent
5c20fca
commit a4ff017
Showing
12 changed files
with
487 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.8.7 | ||
2.8.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
# -- Created by jordantrizz -- Version 0.0.1 | ||
# -- Purpose: Run cron and log the output to stdout, syslog, or a file. | ||
# -- Usage: Add the following to your crontab | ||
# */5 * * * * /home/systemuser/cron.sh | ||
|
||
# Important Variables | ||
SCRIPT_DIR=$(dirname "$(realpath "$0")") | ||
CRON_CMD="" | ||
|
||
# Settings | ||
LOG_TO_STDOUT="1" # - Log to stdout? 0 = no, 1 = yes | ||
LOG_TO_SYSLOG="1" # - Log to syslog? 0 = no, 1 = yes | ||
LOG_TO_FILE="0" # - Log to file? 0 = no, 1 = yes | ||
LOG_FILE="/home/app.goodmorningleland.com/wordpress-crons.log" # Location for wordpress cron. | ||
HEARTBEAT_URL="https://uptime.betterstack.com/api/v1/heartbeat/qemxv615Fi8DUjAhzakbdCnE" # - Heartbeat monitoring URL | ||
POST_CRON_CMD="" # - Command to run after cron completes | ||
|
||
# Log the start time | ||
START_TIME=$(date +%s.%N) | ||
|
||
# Run WordPress crons due now and log the output | ||
CRON_OUTPUT=$(eval $CRON_CMD) | ||
|
||
# Check if there was an error running wp-cli command | ||
if [[ $? -ne 0 ]]; then | ||
echo "Error: $CRON_CMD - command failed" >&2 | ||
echo "$CRON_OUTPUT" | ||
if [[ -n "$POST_CRON_CMD" ]]; then | ||
eval "$POST_CRON_CMD" | ||
fi | ||
exit 1 | ||
fi | ||
|
||
# Check if heartbeat monitoring is enabled and send a request to the heartbeat URL if it is and there are no errors | ||
if [[ -n "$HEARTBEAT_URL" ]] && [[ $? -eq 0 ]] ; then | ||
curl -I -s "$HEARTBEAT_URL" > /dev/null | ||
fi | ||
|
||
# Log the end time and CPU usage | ||
END_TIME=$(date +%s.%N) | ||
|
||
# check if bc installed otherwise use awk | ||
if [[ $(command -v bc) ]]; then | ||
TIME_SPENT=$(echo "$END_TIME - $START_TIME" | bc) | ||
else | ||
TIME_SPENT=$(echo "$END_TIME - $START_TIME" | awk '{printf "%f", $1 - $2}') | ||
fi | ||
CPU_USAGE=$(ps -p $$ -o %cpu | tail -n 1) | ||
|
||
# Check if logging to syslog is enabled | ||
if [[ $LOG_TO_STDOUT == "1" ]]; then | ||
echo -e "Cron job completed in $TIME_SPENT seconds with $CPU_USAGE% CPU usage. \nOutput: $CRON_OUTPUT" | ||
elif [[ $LOG_TO_SYSLOG == "1" ]]; then | ||
echo -e "Cron job completed in $TIME_SPENT seconds with $CPU_USAGE% CPU usage. \nOutput: $CRON_OUTPUT" | logger -t "cron-script" | ||
elif [[ $LOG_TO_FILE == "1" ]]; then | ||
# Log to file in the WordPress install directory | ||
echo "$(date +"%Y-%m-%d %H:%M:%S") - Cron completed in $TIME_SPENT seconds with $CPU_USAGE% CPU usage. \nOutput: $CRON_OUTPUT" >> $LOG_FILE | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Install Notes | ||
* skill -9 lsphp if module doesnt show up for LSWS | ||
* Install php-relay for CLI version and FPM version as they might differ. | ||
|
||
# Install on Litespeed/Openlitespeed | ||
* Following Ubuntu packages install. | ||
* ```cp /usr/lib/php/20190902/relay.so /usr/local/lsws/lsphp74/lib/php/20190902``` | ||
* joe /usr/local/lsws/lsphp74/etc/php/7.4/mods-available | ||
``` | ||
; The path to the extension binary. | ||
; Relative paths will look in `php-config --extension-dir`. | ||
; | ||
extension = relay.so | ||
; Relay license key (via https://relay.so). | ||
; Without a license key Relay will throttle to 16MB memory one hour after startup. | ||
; | ||
; relay.key = | ||
; The environment Relay is running in. | ||
; Supported values: `production`, `staging`, `testing`, `development` | ||
; | ||
; relay.environment = development | ||
; How much memory Relay allocates on startup. This value can either be a | ||
; number like 134217728 or a unit (e.g. 128M) like memory_limit. | ||
; See: https://php.net/manual/faq.using.php#faq.using.shorthandbytes | ||
; | ||
; Relay will allocate at least 16M for overhead structures. | ||
; Set to `0` to disable in-memory caching and use as client only. | ||
; | ||
; relay.maxmemory = 32M | ||
; At what percentage of used memory should Relay start evicting keys. | ||
; | ||
; relay.maxmemory_pct = 95 | ||
; How Relay evicts keys. This has been designed to mirror Redis’ | ||
; options and we currently support `noeviction`, `lru`, and `random`. | ||
; The default `noeviction` policy will proxy all uncached commands | ||
; to Redis, once the in-memory cache is full. | ||
; | ||
; relay.eviction_policy = noeviction | ||
; How many keys should we scan each time we process evictions. | ||
; | ||
; relay.eviction_sample_keys = 128 | ||
; Default to using a persistent connection when calling `connect()`. | ||
; | ||
; relay.default_pconnect = 1 | ||
; The number of databases Relay will create per in-memory cache. | ||
; This setting should match the `databases` setting in your `redis.conf`. | ||
; | ||
; relay.databases = 16 | ||
; The maximum number of PHP workers that will have their own in-memory cache. | ||
; While each PHP worker will have its own connection to Redis, not all | ||
; workers need their own in-memory cache and can be read-only workers. | ||
; | ||
; This setting is per connection endpoint (distinct Redis connections), | ||
; e.g. connecting to two separate instances will double the workers. | ||
; | ||
; relay.max_endpoint_dbs = 32 | ||
; The number of epoch readers allocated on startup. | ||
; | ||
; relay.initial_readers = 128 | ||
; How often (in microseconds) Relay should proactively check the | ||
; connection for invalidation messages from Redis. | ||
; | ||
; relay.invalidation_poll_freq = 5 | ||
; Whether Relay should log debug information. | ||
; Supported levels: `debug`, `verbose`, `notice`, `error`, `off` | ||
; | ||
; relay.loglevel = off | ||
; The path to the file in which information should be logged, if logging is enabled. | ||
; | ||
; relay.logfile = /tmp/relay.log | ||
``` |
Oops, something went wrong.