add instance status option
This commit is contained in:
@@ -375,12 +375,7 @@ add_camera() {
|
|||||||
#Not yet check to see if instance already has a camera
|
#Not yet check to see if instance already has a camera
|
||||||
select camopt in "${options[@]}"
|
select camopt in "${options[@]}"
|
||||||
do
|
do
|
||||||
if [ "$camopt" == generic ]; then
|
if [ "$camopt" == Quit ]; then
|
||||||
main_menu
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$camopt" == generic ]; then
|
|
||||||
echo "Don't add cameras to the template instance."
|
|
||||||
main_menu
|
main_menu
|
||||||
fi
|
fi
|
||||||
echo "Selected instance for camera: $camopt" | log
|
echo "Selected instance for camera: $camopt" | log
|
||||||
@@ -490,14 +485,14 @@ remove_instance() {
|
|||||||
echo
|
echo
|
||||||
if [ $SUDO_USER ]; then user=$SUDO_USER; fi
|
if [ $SUDO_USER ]; then user=$SUDO_USER; fi
|
||||||
if [ -f "/etc/octoprint_instances" ]; then
|
if [ -f "/etc/octoprint_instances" ]; then
|
||||||
#echo 'Do not remove the generic instance!' | log
|
|
||||||
PS3='Select instance number to remove: '
|
PS3='Select instance number to remove: '
|
||||||
readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:graph:]]*\) port:.*/\1/p')
|
readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:graph:]]*\) port:.*/\1/p')
|
||||||
options+=("Quit")
|
options+=("Quit")
|
||||||
unset 'options[0]'
|
unset 'options[0]'
|
||||||
select opt in "${options[@]}"
|
select opt in "${options[@]}"
|
||||||
do
|
do
|
||||||
if [ "$opt" == Quit ] || [ "$opt" == generic ]; then
|
if [ "$opt" == Quit ]; then
|
||||||
main_menu
|
main_menu
|
||||||
fi
|
fi
|
||||||
echo "Selected instance to remove: $opt" | log
|
echo "Selected instance to remove: $opt" | log
|
||||||
@@ -741,7 +736,7 @@ prepare () {
|
|||||||
#install oprint
|
#install oprint
|
||||||
sudo -u $user /home/$user/OctoPrint/bin/pip install OctoPrint
|
sudo -u $user /home/$user/OctoPrint/bin/pip install OctoPrint
|
||||||
#start server and run in background
|
#start server and run in background
|
||||||
echo 'Creating generic OctoPrint service...'
|
echo 'Creating generic OctoPrint template service...'
|
||||||
cat $SCRIPTDIR/octoprint_generic.service | \
|
cat $SCRIPTDIR/octoprint_generic.service | \
|
||||||
sed -e "s/OCTOUSER/$user/" \
|
sed -e "s/OCTOUSER/$user/" \
|
||||||
-e "s#OCTOPATH#/home/$user/OctoPrint/bin/octoprint#" \
|
-e "s#OCTOPATH#/home/$user/OctoPrint/bin/octoprint#" \
|
||||||
@@ -1096,9 +1091,6 @@ back_up_all() {
|
|||||||
readarray -t instances < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
|
readarray -t instances < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
|
||||||
unset 'instances[0]'
|
unset 'instances[0]'
|
||||||
for instance in "${instances[@]}"; do
|
for instance in "${instances[@]}"; do
|
||||||
if [ "$instance" == generic ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
echo $instance
|
echo $instance
|
||||||
back_up $instance
|
back_up $instance
|
||||||
done
|
done
|
||||||
@@ -1115,8 +1107,8 @@ replace_id() {
|
|||||||
unset 'options[0]'
|
unset 'options[0]'
|
||||||
select opt in "${options[@]}"
|
select opt in "${options[@]}"
|
||||||
do
|
do
|
||||||
if [ "$opt" == Quit ] || [ "$opt" == generic ]; then
|
if [ "$opt" == Quit ]; then
|
||||||
exit 0
|
main_menu
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Selected $opt to replace serial ID" | log
|
echo "Selected $opt to replace serial ID" | log
|
||||||
@@ -1141,6 +1133,20 @@ octo_deploy_update() {
|
|||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
instance_status() {
|
||||||
|
echo
|
||||||
|
echo "*******************************************"
|
||||||
|
readarray -t instances < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
|
||||||
|
unset 'instances[0]'
|
||||||
|
echo "Instance: Status:"
|
||||||
|
for instance in "${instances[@]}"; do
|
||||||
|
status=$(systemctl status $instance | sed -n -e 's/Active: \([[:graph:]]*\) .*/\1/p')
|
||||||
|
echo "$instance $status"
|
||||||
|
done
|
||||||
|
echo "*******************************************"
|
||||||
|
main_menu
|
||||||
|
}
|
||||||
|
|
||||||
main_menu() {
|
main_menu() {
|
||||||
VERSION=0.1.6
|
VERSION=0.1.6
|
||||||
#reset
|
#reset
|
||||||
@@ -1158,7 +1164,7 @@ main_menu() {
|
|||||||
echo
|
echo
|
||||||
PS3='Select operation: '
|
PS3='Select operation: '
|
||||||
if [ -f "/etc/octoprint_instances" ]; then
|
if [ -f "/etc/octoprint_instances" ]; then
|
||||||
options=("New instance" "Delete instance" "Add Camera" "USB port testing" "Sync Users" "Create Backup" "Restore Backup" "Update" "Quit")
|
options=("New instance" "Delete instance" "Add Camera" "Instance Status" "USB port testing" "Sync Users" "Create Backup" "Restore Backup" "Update" "Quit")
|
||||||
else
|
else
|
||||||
options=("Prepare system" "USB port testing" "Update" "Quit")
|
options=("Prepare system" "USB port testing" "Update" "Quit")
|
||||||
fi
|
fi
|
||||||
@@ -1181,6 +1187,10 @@ main_menu() {
|
|||||||
add_camera
|
add_camera
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
"Instance Status")
|
||||||
|
instance_status
|
||||||
|
break
|
||||||
|
;;
|
||||||
"USB port testing")
|
"USB port testing")
|
||||||
usb_testing
|
usb_testing
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user