mirror of
https://github.com/guezoloic/serverconfig.git
synced 2026-01-25 09:34:23 +00:00
feat: add info_print flag
This commit is contained in:
@@ -39,7 +39,7 @@ if [[ "--install" == $INSTALLED ]]; then
|
||||
crontab -l | grep -F "$CRON_JOB" > /dev/null 2>&1
|
||||
if ! crontab -l | grep -Fq "$CRON_JOB"; then
|
||||
(crontab -l 2>/dev/null; echo "$CRON_JOB") | crontab -
|
||||
info_print "Cron job added." 6
|
||||
info_print "Cron job added." $SUCCESS_FLAG
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -76,16 +76,16 @@ while IFS= read -r SOURCE_PATH || [ -n "$SOURCE_PATH" ]; do
|
||||
"${aws_cmd[@]}"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
info_print "Error while syncing $SOURCE_PATH to the AWS server." 3
|
||||
info_print "Error while syncing $SOURCE_PATH to the AWS server." $ERROR_FLAG
|
||||
BACKUPSUCCESSED=false
|
||||
exit 1
|
||||
|
||||
else
|
||||
info_print "Successfully synced $SOURCE_PATH" 6
|
||||
info_print "Successfully synced $SOURCE_PATH" $SUCCESS_FLAG
|
||||
BACKUPSUCCESSED=true
|
||||
fi
|
||||
else
|
||||
info_print "$SOURCE_PATH not found or inaccessible." 3
|
||||
info_print "$SOURCE_PATH not found or inaccessible." $ERROR_FLAG
|
||||
BACKUPSUCCESSED=false
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -9,11 +9,16 @@ if [[ "--install" == $INSTALLED ]]; then
|
||||
==================================================\n\
|
||||
disk-monitor Installation\n\
|
||||
--------------------------------------------------"
|
||||
if ! command -v crontab >/dev/null 2>&1; then
|
||||
info_print "Cron job added." $ERROR_FLAG
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CRON_JOB="0 3 * * 1 $SCRIPT_FILE/scripts/disk-monitor.sh"
|
||||
crontab -l | grep -F "$CRON_JOB" > /dev/null 2>&1
|
||||
if ! crontab -l | grep -Fq "$CRON_JOB"; then
|
||||
(crontab -l 2>/dev/null; echo "$CRON_JOB") | crontab -
|
||||
info_print "Cron job added." 6
|
||||
info_print "Cron job added." $SUCCESS_FLAG
|
||||
fi
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
@@ -19,7 +19,7 @@ if [[ "--install" == $INSTALLED ]]; then
|
||||
source /etc/serverconfig/.env
|
||||
|
||||
if [[ -f "$ETC_DIR/docker-compose.yml" ]]; then
|
||||
docker compose -f "$ETC_DIR/docker-compose.yml" up -d --force-recreate && \
|
||||
docker compose -f "$ETC_DIR/docker-compose.yml" up -d --force-recreate --remove-orphans && \
|
||||
info_print "$ETC_DIR/docker-compose.yml is running." 6;
|
||||
|
||||
else info_print "no docker-compose.yml found at $ETC_DIR" 3;
|
||||
|
||||
@@ -14,15 +14,15 @@ if [[ "--install" == $INSTALLED ]]; then
|
||||
file='/etc/pam.d/common-session'
|
||||
|
||||
if [[ ! -f "$file" ]]; then
|
||||
info_print "$file doesn't found." 3
|
||||
info_print "$file doesn't found." $ERROR_FLAG
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! grep -Fxq "$login" "$file"; then
|
||||
echo "$login" >> "$file"
|
||||
info_print "login command added to $file." 6
|
||||
info_print "login command added to $file." $SUCCESS_FLAG
|
||||
else
|
||||
info_print "login command already added to $file." 2
|
||||
info_print "login command already added to $file." $WARN_FLAG
|
||||
fi
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user