Files
Virtnet.bond/runner.sh

74 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
git_pull="${SCRIPT_DIR}/gitpull.sh"
git_push="${SCRIPT_DIR}/gitpush.sh"
git_log="${SCRIPT_DIR}/laravallog.sh"
git_cache="${SCRIPT_DIR}/laravalcache.sh"
divider="==============================================="
while true; do
clear
cat <<EOF
$divider
Paymenter Utility Runner
$divider
[1] Run gitpull.sh
[2] Run gitpush.sh
[3] Run laravallog.sh
[4] Run laravalcache.sh
[5] Clear Laravel log
[6] Exit
$divider
Select an option by pressing the number key.
EOF
read -n1 -s choice
echo
case "$choice" in
1)
[ -x "$git_pull" ] || chmod +x "$git_pull"
"$git_pull"
;;
2)
[ -x "$git_push" ] || chmod +x "$git_push"
"$git_push"
;;
3)
[ -x "$git_log" ] || chmod +x "$git_log"
"$git_log"
;;
4)
[ -x "$git_cache" ] || chmod +x "$git_cache"
"$git_cache"
;;
5)
LOG_FILE="${SCRIPT_DIR}/storage/logs/laravel.log"
if [ -f "$LOG_FILE" ]; then
> "$LOG_FILE"
echo "Log file cleared successfully: $LOG_FILE"
else
echo "Log file not found: $LOG_FILE"
fi
;;
6)
echo "Goodbye!"
exit 0
;;
*)
echo "Invalid selection. Press any key to continue."
read -n1 -s
;;
esac
echo
echo "Press any key to return to the menu..."
read -n1 -s
done