mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-17 12:34:29 +05:00
Add Octoprint Service toggle function and a new confirm message
This commit is contained in:
@@ -219,3 +219,25 @@ flash_mcu(){
|
||||
fi
|
||||
start_klipper
|
||||
}
|
||||
|
||||
toggle_octoprint_service(){
|
||||
if systemctl is-enabled octoprint.service -q; then
|
||||
status_msg "Service is enabled! Disabling now ..."
|
||||
sudo systemctl stop octoprint && sudo systemctl disable octoprint -q
|
||||
sleep 2
|
||||
CONFIRM_MSG=" Octoprint Service is now >>> DISABLED <<< !"
|
||||
else
|
||||
status_msg "Service is disabled! Enabling now ..."
|
||||
sudo systemctl enable octoprint -q && sudo systemctl start octoprint
|
||||
sleep 2
|
||||
CONFIRM_MSG=" Octoprint Service is now >>> ENABLED <<< !"
|
||||
fi
|
||||
}
|
||||
|
||||
read_octoprint_service_status(){
|
||||
if ! systemctl is-enabled octoprint.service -q; then
|
||||
OPRINT_SERVICE_STATUS="${green}[Enable]${default} Octoprint service "
|
||||
else
|
||||
OPRINT_SERVICE_STATUS="${red}[Disable]${default} Octoprint service "
|
||||
fi
|
||||
}
|
||||
@@ -105,6 +105,9 @@ advanced_ui(){
|
||||
top_border
|
||||
echo -e "| $(title_msg "~~~~~~~~~~~~~ [ Advanced Menu ] ~~~~~~~~~~~~~") | "
|
||||
hr
|
||||
echo -e "| 0) $OPRINT_SERVICE_STATUS| "
|
||||
hr
|
||||
echo -e "| | "
|
||||
echo -e "| 1) [Switch Klipper version] | "
|
||||
echo -e "| | "
|
||||
echo -e "| 2) [Build Firmware] | "
|
||||
@@ -113,8 +116,6 @@ advanced_ui(){
|
||||
echo -e "| 5) [Write Printer-ID to printer.cfg] | "
|
||||
echo -e "| 6) [Write DWC2-for-klipper config] | "
|
||||
echo -e "| | "
|
||||
echo -e "| x) [Enable/Disable Octoprint service] | "
|
||||
echo -e "| | "
|
||||
quit_footer
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user