我正在尝试使用本指南中的代码运行 gnome 扩展 https://gjs.guide/extensions/upgrading/legacy-documentation.html#extensionUbuntu 22.04、GNOME 42.9、waylandcontents 扩展...
我正在尝试使用本指南中的代码运行 gnome 扩展 https://gjs.guide/extensions/upgrading/legacy-documentation.html#extension Ubuntu 22.04、GNOME 42.9、wayland
extension.js 的内容(从上面的链接复制):
const St = imports.gi.St;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const {
gettext: _,
} = ExtensionUtils;
class Extension {
enable() {
// Create a panel button
this._indicator = new PanelMenu.Button(0.0, Me.metadata.name, false);
// Add an icon
const icon = new St.Icon({
icon_name: 'face-laugh-symbolic',
style_class: 'system-status-icon',
});
this._indicator.add_child(icon);
// Add the indicator to the panel
Main.panel.addToStatusArea(Me.metadata.uuid, this._indicator);
// Add a menu item to open the preferences window
this._indicator.menu.addAction(_('Preferences'),
() => ExtensionUtils.openPrefs());
this._count = 0;
}
disable() {
if (this._indicator) {
this._indicator.destroy();
this._indicator = null;
}
}
}
function init() {
ExtensionUtils.initTranslations();
return new Extension();
}
metadata.json的内容:
{
"uuid": "[email protected]",
"name": "Example Extension",
"description": "An example extension",
"shell-version": [ "42.9" ],
"url": "https://gjs.guide/extensions"
}
错误:
我正在开展一个项目,需要使用 SSM 文档将 Spring Boot 应用程序 Pet Clinic 安装到 Ubuntu 22 服务器上。我已附加 Systems Manager 运行文档。错误是...
我正在开展一个项目,需要使用 SSM 文档将 Spring Boot 应用程序 Pet Clinic 到 Ubuntu 22 服务器上。我已附加 Systems Manager 运行文档。以下错误来自命令 sudo journalctl -u spring-petclinic.service 。我尝试授予任何和所有访问权限,以 root 身份运行,但仍然不起作用。
关于如何让该应用程序保持运行,您有什么想法吗?
May 17 21:52:36 ip-10-0-4-141 systemd[1]: spring-petclinic.service: Failed with result 'exit-code'.
May 17 21:52:36 ip-10-0-4-141 systemd[1]: spring-petclinic.service: Scheduled restart job, restart counter is at 3.
May 17 21:52:36 ip-10-0-4-141 systemd[1]: Stopped Spring PetClinic Application.
May 17 21:52:36 ip-10-0-4-141 systemd[1]: Started Spring PetClinic Application.
May 17 21:52:36 ip-10-0-4-141 java[7076]: Error: Unable to access jarfile /clinic/spring-petclinic/target/*.jar
May 17 21:52:36 ip-10-0-4-141 systemd[1]: spring-petclinic.service: Main process exited, code=exited, status=1/FAILURE
May 17 21:52:36 ip-10-0-4-141 systemd[1]: spring-petclinic.service: Failed with result 'exit-code'.
May 17 21:52:36 ip-10-0-4-141 systemd[1]: spring-petclinic.service: Scheduled restart job, restart counter is at 4.
May 17 21:52:36 ip-10-0-4-141 systemd[1]: Stopped Spring PetClinic Application.
May 17 21:52:36 ip-10-0-4-141 systemd[1]: Started Spring PetClinic Application.
May 17 21:52:36 ip-10-0-4-141 java[7077]: Error: Unable to access jarfile /clinic/spring-petclinic/target/*.jar
May 17 21:52:36 ip-10-0-4-141 systemd[1]: spring-petclinic.service: Main process exited, code=exited, status=1/FA
---
schemaVersion: '2.2'
description: Install Java 17 and run the Spring PetClinic application
parameters: {}
mainSteps:
- name: InstallJava17
action: aws:runShellScript
inputs:
runCommand:
- |
#!/bin/bash
# Check if Java is installed
if java -version > /dev/null 2>&1; then
echo "Java is installed. No need to restart"
else
echo "Java is not installed. Restarting after install...."
# Update package lists
sudo apt-get update
# Install OpenJDK 17
sudo apt-get install -y openjdk-17-jdk
# Verify Java installation
java -version
exit 194
fi
- name: DownloadApplication
action: aws:runShellScript
inputs:
runCommand:
- |
#!/bin/bash
# clean the environment file
cat /dev/null > /etc/environment
# set the full path
echo "PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:\$JAVA_HOME/bin\"" | sudo tee -a /etc/environment
# grab the java home and set it in the environment
JAVA_HOME=$(sudo update-alternatives --config java | grep -o -E '/usr/lib/jvm/[a-zA-Z0-9-]+')
echo "JAVA_HOME=\"$JAVA_HOME\"" | sudo tee -a /etc/environment
# update the variables
source /etc/environment
echo "whoami?"
sudo whoami
# Create and move into new folder
sudo mkdir /clinic
cd /clinic
# Download the repository
echo "# Download the repository"
sudo git clone https://github.com/spring-projects/spring-petclinic.git
# Move into the folder
echo "# Move into the folder"
cd spring-petclinic
# Start the Maven build
echo "# Start the Maven build"
./mvnw package
- name: CreateSystemdService
action: aws:runShellScript
inputs:
runCommand:
- |
#!/bin/bash
# clean the environment file
cat /dev/null > /etc/environment
# set the full path
echo "PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:\$JAVA_HOME/bin\"" | sudo tee -a /etc/environment
# grab the java home and set it in the environment
JAVA_HOME=$(sudo update-alternatives --config java | grep -o -E '/usr/lib/jvm/[a-zA-Z0-9-]+')
echo "JAVA_HOME=\"$JAVA_HOME\"" | sudo tee -a /etc/environment
# update the variables
source /etc/environment
# Create systemd service unit
echo "# Create systemd service unit"
sudo tee /etc/systemd/system/spring-petclinic.service <<EOF
[Unit]
Description=Spring PetClinic Application
After=network.target
echo "THIS IS THE PATH"
echo $PATH
echo "THIS IS THE JAVA_HOME"
echo $JAVA_HOME
[Service]
ExecStart=/usr/lib/jvm/java-17-openjdk-amd64/bin/java -jar /clinic/spring-petclinic/target/*.jar
Restart=always
User=root
[Install]
WantedBy=multi-user.target
EOF
echo "whoami?"
sudo whoami
# Reload systemd and start the service
echo "# Reload systemd and start the service"
echo "whoami?"
sudo whoami
echo "daemon is reloading"
sudo systemctl daemon-reload
echo "whoami?"
sudo whoami
echo "enabling spring-petclinic"
sudo systemctl enable spring-petclinic
echo "whoami?"
sudo whoami
echo "starting spring-petclinic"
sudo systemctl start spring-petclinic