Skip to content

Commit

Permalink
Run commands within 'screen' in case the session closes abruptly.
Browse files Browse the repository at this point in the history
  • Loading branch information
cybiohub committed Dec 6, 2022
1 parent ad11194 commit e4e815b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v0.1.17 - 2022-12-05
# ## Added
- Launch commands with 'screen' in case the session closes abruptly.
- Add do-release-upgrade option (hidden).

v0.1.16 - 2022-11-09
## Added
- Add list --upgradable option.
Expand All @@ -8,5 +13,5 @@ v0.1.15 - 2022-09-07

v0.1.12 - 2021-12-13
## Added
- Fisrt commit.
- First commit.
- Added auto-completion.
26 changes: 21 additions & 5 deletions bin/majserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
# * Author: (c) 2004-2022 Cybionet - Ugly Codes Division
# *
# * File: majserver.sh
# * Version: 0.1.16
# * Version: 0.1.17
# *
# * Description: Tool to configure update system.
# *
# * Creation: December 16, 2017
# * Change: November 09, 2022
# * Change: October 05, 2022
# *
# * **************************************************************************
# * chmod 500 majserver.sh
Expand All @@ -36,7 +36,7 @@ appYear=$(date +%Y)

# ## Application informations.
appHeader="(c) 2004-${appYear} Cybionet - Ugly Codes Division"
readonly appVersion='0.1.16'
readonly appVersion='0.1.17'


#############################################################################################
Expand All @@ -62,6 +62,7 @@ if [ ! -f '/etc/logrotate.d/majserver' ]; then
}" > /etc/logrotate.d/majserver
fi


#############################################################################################
# ## FUNCTIONS

Expand Down Expand Up @@ -91,17 +92,26 @@ function aptUpdate() {
# ## Launch upgrade.
function aptUpgrade() {
reminderCheck
apt-get upgrade "${FORCEIPV4}"
#apt-get upgrade "${FORCEIPV4}"
screen -S "majserver" bash -c "apt-get upgrade ${FORCEIPV4}; echo -e '\n\e[38;5;208mPress enter to exit screen mode\e[0m\n\n'; read -r ANSWER"
echo "${aptDate} - UpGrade System" >> "${APTLOG}"
}

# ## Launch dist-upgrade.
function aptDistUpgrade() {
reminderCheck
apt-get dist-upgrade "${FORCEIPV4}"
#apt-get dist-upgrade "${FORCEIPV4}"
screen -S "majserver" bash -c "apt-get dist-upgrade ${FORCEIPV4}; echo -e '\n\e[38;5;208mPress enter to exit screen mode\e[0m\n\n'; read -r ANSWER"
echo "${aptDate} - Distribution UpGrade" >> "${APTLOG}"
}

# ## Launch do-release-upgrade.
function aptDoReleaseUpgrade() {
reminderCheck
screen -S "majserver" bash -c "apt-get do-release-upgrade ${FORCEIPV4}; echo -e '\n\e[38;5;208mPress enter to exit screen mode\e[0m\n\n'; read -r ANSWER"
echo "${aptDate} - Do Release Upgrade" >> "${APTLOG}"
}

# ## Launch autoremove.
function autoRemove() {
if [ -f '/var/run/reboot-required' ]; then
Expand Down Expand Up @@ -179,6 +189,12 @@ case "${1}" in
aptDistUpgrade
rebootNeeded
;;

-drg|do-release-upgrade)
header
aptDoReleaseUpgrade
rebootNeeded
;;
-arm|autoremove)
header
autoRemove
Expand Down

0 comments on commit e4e815b

Please sign in to comment.