相关疑难解决方法(0)

与cron gsettings

我写了一个改变壁纸的bash脚本(对于GNOME3).

#!/bin/bash

# Wallpaper's directory.
dir="${HOME}/images/wallpapers/"

# Random wallpaper.
wallpaper=`find "${dir}" -type f | shuf -n1`

# Change wallpaper.
# http://bit.ly/HYEU9H
gsettings set org.gnome.desktop.background picture-options "spanned"
gsettings set org.gnome.desktop.background picture-uri "file://${wallpaper}"
Run Code Online (Sandbox Code Playgroud)

在终端仿真器(例如gnome-terminal)中执行的脚本效果很好.在执行cron或ttyX终端时出错:

** (process:26717): WARNING **: Command line `dbus-launch --autolaunch=d64a757758b286540cc0858400000603 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n

** (process:26717): WARNING **: Command line `dbus-launch --autolaunch=d64a757758b286540cc0858400000603 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n

** (process:26721): WARNING **: Command line …
Run Code Online (Sandbox Code Playgroud)

linux bash cron gnome

22
推荐指数
2
解决办法
1万
查看次数

标签 统计

bash ×1

cron ×1

gnome ×1

linux ×1