Skip to content

Commit

Permalink
chore: Update SystemGuard app setup and dependencies in crontab
Browse files Browse the repository at this point in the history
```
  • Loading branch information
codeperfectplus committed Aug 30, 2024
1 parent 5bb308f commit 70da649
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ System Guard is a Flask app designed to monitor server stats such as CPU, Memory
```bash
bash setup.sh
```
It will install the SystemGuard app and its dependencies. The app will be available at `http://localhost:5050`.

It will install the SystemGuard app and its dependencies in the crontab and it will be started automatically every time the server is restarted. The app will be available at `http://localhost:5050`.

## Dependencies(must be installed)

Expand All @@ -21,6 +22,9 @@ It will install the SystemGuard app and its dependencies. The app will be availa
- Kill the process that is consuming the most CPU.
- Real-time monitoring of server stats.
- Responsive design that works on mobile, tablet, and desktop.
- Update itself to the latest version.
- Easy download and installation using a bash script.


## Product Screenshots

Expand Down
11 changes: 6 additions & 5 deletions src/scripts/dashboard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ log_message() {

# Determine the directory where this script is located
SCRIPT_DIR="$(dirname "$(realpath "$0" 2>/dev/null || readlink -f "$0")")"

# root directory of the project is two levels up
PROJECT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
# Define variables for paths relative to the script's directory
FLASK_APP_PATH="${FLASK_APP_PATH:-$SCRIPT_DIR/app.py}"
REQUIREMENTS_FILE="${REQUIREMENTS_FILE:-$SCRIPT_DIR/requirements.txt}"
FLASK_APP_PATH="${FLASK_APP_PATH:-$PROJECT_DIR/app.py}"
REQUIREMENTS_FILE="${REQUIREMENTS_FILE:-$PROJECT_DIR/requirements.txt}"
FLASK_PORT="${FLASK_PORT:-5050}"
LOG_FILE="/home/$(whoami)/logs/systemdashboard_flask.log"
USERNAME="$(whoami)"
Expand Down Expand Up @@ -48,7 +49,7 @@ fi
source "$CONDA_SETUP_SCRIPT"

# Define Conda environment name
CONDA_ENV_NAME="dashboard"
CONDA_ENV_NAME="dashboar"

echo "Conda environment name: $CONDA_ENV_NAME"
echo $CONDA_EXECUTABLE
Expand All @@ -75,7 +76,7 @@ export FLASK_ENV=development # or production
if ! pgrep -f "flask run --host=0.0.0.0 --port=$FLASK_PORT" > /dev/null; then
# git pull in FLASK_APP_PATH directory
current_dir=$(pwd)
cd "$SCRIPT_DIR"
cd "$PROJECT_DIR"
if ! git pull; then
log_message "Failed to pull updates from Git repository."
cd "$current_dir"
Expand Down

0 comments on commit 70da649

Please sign in to comment.