AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-515237

SingularisArt's questions

Martin Hope
SingularisArt
Asked: 2022-11-29 10:49:28 +0800 CST

无法让 systemd 运行脚本

  • 6

这是我的mailsync.service和mailsync.timer文件位于~/.config/systemd/user/:

[Unit]
Description=Mail sync

[Service]
Type=oneshot
Nice=10
ExecStart=/home/singularis/.local/bin/systemd/mailsync
Environment="HOME=/home/singularis"
[Unit]
Description=Sync emails with mbsync on schedule

[Timer]
OnBootSec=2m
OnUnitActiveSec=2m
Persistent=true

[Install]
WantedBy=timers.target

内容如下/home/singularis/.local/bin/systemd/mailsync:

#!/bin/sh

MBSYNCRC="$XDG_CONFIG_HOME/mbsync/mbsyncrc"
alias mbsync="mbsync -c $XDG_CONFIG_HOME/mbsync/mbsyncrc"

# Run only if not already running in other instance
pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;}

export GPG_TTY="$(tty)"

[ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc"
[ -n "$MPOPRC" ] || MPOPRC="$HOME/.config/mpop/config"

lastrun="${XDG_CONFIG_HOME:-$HOME/.config}/neomutt/.mailsynclastrun"

# Settings are different for MacOS (Darwin) systems.
case "$(uname)" in
  Darwin)
    notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
    ;;
  *)
    case "$(readlink -f /sbin/init)" in
      *systemd*|*openrc*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;;
    esac
    # remember if a display server is running since `ps` doesn't always contain a display
    pgrepoutput="$(pgrep -ax X\(\|org\|wayland\))"
    displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)"
    notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do
      export DISPLAY=$x
      notify-send --app-name="mutt-wizard" "New mail!" "? $2 new mail(s) in \`$1\` account."
    done ;}
    ;;
esac

# Check account for new mail. Notify if there is new content.
syncandnotify() {
  acc="$(echo "$account" | sed "s/.*\///")"
  if [ "$1" = "pop" ]; then
    # Handle POP
    mpop "$acc"
  else
    # Handle IMAP
    if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
  fi
  new=$(find\
    "$HOME/.local/share/mail/$acc/"[Ii][Nn][Bb][Oo][Xx]/new/ \
    "$HOME/.local/share/mail/$acc/"[Ii][Nn][Bb][Oo][Xx]/cur/ \
    -type f -newer "$lastrun" 2> /dev/null)
      newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
      [ -z "$MAILSYNC_MUTE" ] && case 1 in
      $((newcount > 0)) ) notify "$acc" "$newcount" ;;
  esac
}

# Sync accounts passed as argument or all.
if [ "$#" -gt "0" ]; then
  for arg in "$@"; do
    [ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1
  done
  accounts=$*
fi

[ -z "$accounts" ] && accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC" 2>/dev/null)"
[ -z "$pop_accounts" ] && [ -x $MPOPRC ] && pop_accounts="$(awk '/^account/ {print $2}' "$MPOPRC" 2>/dev/null)"

# Parallelize multiple accounts
for account in $accounts; do
  syncandnotify "imap" &
done

for account in $pop_accounts; do
  syncandnotify "pop" &
done

wait

notmuch new --quiet

#Create a touch file that indicates the time of the last run of mailsync
touch "$lastrun"

这是输出journalctl --user -xeu mailsync.service:

Nov 28 10:44:16 singularis systemd[871]: Failed to start Mail sync.
░░ Subject: A start job for unit UNIT has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit UNIT has finished with a failure.
░░ 
░░ The job identifier is 1336 and the job result is failed.

我错过了什么吗?我从Luke Smith那里得到了这段代码。

systemd
  • 1 个回答
  • 38 Views
Martin Hope
SingularisArt
Asked: 2022-06-10 22:54:12 +0800 CST

Xdg-Mime 不会更改 .xopp (Xournalpp) 文件的默认应用程序

  • 1

我正在尝试更改 filetype 的默认应用程序.xopp,它是 xournalpp 应用程序的文件。我目前运行了以下命令:

xdg-mime query filetype 2022-06-09/note.xopp

这给了我:application/gzip。如何仅.xopp在 xournalpp 中打开以 open 结尾的文件?当我使用文件浏览器时它可以工作,但是当我运行时:

xdg-open 2022-06-09/note.xopp

它在一个解压缩程序中打开它。

我目前正在使用Manjaro Linux.

manjaro xdg
  • 1 个回答
  • 80 Views
Martin Hope
SingularisArt
Asked: 2022-04-23 10:20:44 +0800 CST

没有可用的默认控制器 Bluetooth Arch Linux

  • 2

信息

昨天我的蓝牙工作正常,但是当我用 更新所有软件包时yay,我的蓝牙无法连接。今天,我跑了:

sudo pacman -Syu
yay -Syu

现在我的蓝牙无法连接。

当我打开bluetoothctl时,它给了我No default controller available。

另外,您能否向我解释一下您希望我运行的所有命令,因为我对 Arch Linux 或 Linux 操作系统不太了解?感谢任何试图帮助我的人!:)

调试

我跑了:

sudo systemctl enable bluetooth 
sudo systemctl start bluetooth

sudo systemctl status bluetooth给我:

● bluetooth.service - Bluetooth service
     Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; vendor preset: disable>
     Active: active (running) since Thu 2022-04-21 03:49:22 PDT; 1 day 7h ago
       Docs: man:bluetoothd(8)
   Main PID: 15162 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 13909)
     Memory: 852.0K
        CPU: 28ms
     CGroup: /system.slice/bluetooth.service
             └─15162 /usr/lib/bluetooth/bluetoothd --compat

Apr 21 03:49:22 hashem-damrah systemd[1]: Starting Bluetooth service...
Apr 21 03:49:22 hashem-damrah bluetoothd[15162]: Bluetooth daemon 5.64
Apr 21 03:49:22 hashem-damrah systemd[1]: Started Bluetooth service.
Apr 21 03:49:22 hashem-damrah bluetoothd[15162]: Starting SDP server
Apr 21 03:49:22 hashem-damrah bluetoothd[15162]: Bluetooth management interface 1.21 initialized
Apr 22 11:08:58 hashem-damrah systemd[1]: bluetooth.service: Current command vanished from the >

这是输出rfkill list:

0: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no

这是输出sudo lsusb:

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 05c8:03d2 Cheng Uei Precision Industry Co., Ltd (Foxlink) HP TrueVision HD Camera
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

这是输出sudo lsmod | grep blue:

bluetooth             856064  11 btrtl,btmtk,btintel,btbcm,bnep
ecdh_generic           16384  1 bluetooth
rfkill                 32768  6 hp_wmi,bluetooth,cfg80211
crc16                  16384  2 bluetooth,ext4
arch-linux bluetooth
  • 1 个回答
  • 1070 Views
Martin Hope
SingularisArt
Asked: 2022-04-10 23:41:27 +0800 CST

无法加载模块“colorreload-gtk-module”简单屏幕录像机

  • 1

就在最近,当我运行: 时simplescreenrecorder,我收到以下错误消息:

Gtk-Message: 00:44:36.847: Failed to load module "colorreload-gtk-module"
Cannot mix incompatible Qt library (5.15.2) with this library (5.15.3)
zsh: IOT instruction (core dumped)  simplescreenrecorder

我怎样才能让这个错误消失?

gtk system-failure
  • 1 个回答
  • 344 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve