小编Dav*_*erd的帖子

运行自定义脚本的 crontab 没有声音

#! /bin/bash

# Read battery percentage value
OUT=`upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep percentage`

# Select only the int value
IFS=':' read -ra P <<< "$OUT"
PERCENTAGE="%"
BATTERY_VALUE=${P[1]%$PERCENTAGE}

# Send a notification if battery level is under 15% and not on AC power
if ! on_ac_power; then
  if (($BATTERY_VALUE  < "15")); then
      eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";
      notify-send -u critical -i "battery-caution" "Battery low! You should plug in your laptop!"
      /usr/bin/aplay /usr/share/sounds/desktop-logout.oga
  fi
fi

# Send a …
Run Code Online (Sandbox Code Playgroud)

sound cron pulseaudio

3
推荐指数
1
解决办法
1398
查看次数

标签 统计

cron ×1

pulseaudio ×1

sound ×1