adi1090x / dynamic-wallpaper

A simple bash script to set wallpapers according to current time, using cron job scheduler.
GNU General Public License v3.0
1.88k stars 115 forks source link

Permission denied error #107

Closed Erryo closed 4 months ago

Erryo commented 6 months ago

I am using fedora 39 on awesomewm with kitty, I am using a script to append to the crontab tabs (crontab -e) , i noticed the wallpaper wasn't changing based on the time so i placed a command in the crontab -e to save the output/errors of the command, here is the output of the file File: /tmp/mycommand.log 1 │ 0 * * * * env PATH=/home/infy/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin:/home/infy/.local │ /bin:/home/infy/.cargo/bin:/var/lib/flatpak/exports/bin:/.local/share/flatpak/exports/bin:/home/infy/.local/bin:/home/infy/.cargo/bi │ n:/var/lib/flatpak/exports/bin:/.local/share/flatpak/exports/bin DISPLAY=:0 DESKTOP_SESSION=awesome DBUS_SESSION_BU │ S_ADDRESS="unix:path=/run/user/1000/bus " /usr/bin/dwall -s mojave /run/user/1000/ 2 │ [*] Using style : mojave 3 │ tput: No value for $TERM and no -T specified 4 │ tput: No value for $TERM and no -T specified 5 │ /usr/bin/dwall: line 193: /usr/share/dynamic-wallpaper/images/mojave/20.jpg: Permission denied 6 │ tput: No value for $TERM and no -T specified 7 │ tput: No value for $TERM and no -T specified I tried adding TERM=xterm-kitty to the crontab and it did not change the output;But when i coppy the command from the crontab and run it myself i get no error and it changes perfectly; This is my first time sumbiting a issue and using github The script i use to chage the crontab#!/bin/bash crontab -r (crontab -l 2>/dev/null; echo "MAILTO=Myemail@provider") | crontab - (crontab -l 2>/dev/null; echo "*/1 * * * * /home/infy/.config/awesome/test.sh >/tmp/mycommand.log 2>&1") | crontab - (crontab -l 2>/dev/null; echo "0 * * * * env PATH=/home/infy/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin:/home/infy/.local/bin:/home/infy/.cargo/bin:/var/lib/flatpak/exports/bin:/.local/share/flatpak/exports/bin:/home/infy/.local/bin:/home/infy/.cargo/bin:/var/lib/flatpak/exports/bin:/.local/share/flatpak/exports/bin DISPLAY=:0 DESKTOP_SESSION=awesome DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus " /usr/bin/dwall -s sahara /run/user/1000/") | crontab - (crontab -l 2>/dev/null; echo "") | crontab - The last line is there becouse apparently crontab doesnt run the last line , i tried running the script with and without the last line and it gets me the same result Obviously i changed the MAILTO for privacy reasons. Nothing shows up in my inbox; The output of 'echo $DESKTOP_SESSION' 'awesome';

Erryo commented 4 months ago

Issue fixed , I forgot to include:XDG_RUNTIME_DIR In the crontab

dukercs commented 3 months ago

Please could you share your crontab line?

/usr/bin/dwall: linha 193: /usr/share/dynamic-wallpaper/images/room/18.jpg: Permissão negada (permission denied)

line 193 - $SETTER "$image.$FORMAT" vars at execution SETTER="feh --bg-fill" image=/usr/share/dynamic-wallpaper/images/room/18 FORMAT=jpg

0 env PATH=/home/dukercs/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin XDG_RUNTIME_DIR="/run/user/1000" DISPLAY=:0 DESKTOP_SESSION=bspwm DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" /usr/bin/dwall -s room > /tmp/logcrondwall.tmp 2>&1

dukercs commented 3 months ago

Hello I figure it out whats happened here for some reason the main script doesn't read the variable $XDG_SESSION_TYPE and without it there's no SETTER var used inside the main script, so I've added XDG_SESSION_TYPE=x11 to my crontab line and it worked very well.

0 env PATH=/home/dukercs/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin XDG_RUNTIME_DIR="/run/user/1000" XDG_SESSION_TYPE=x11 DISPLAY=:0 DESKTOP_SESSION=bspwm DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" /usr/bin/dwall -s room

eyeaxamsterdam commented 3 months ago

Hello I figure it out whats happened here for some reason the main script doesn't read the variable $XDG_SESSION_TYPE and without it there's no SETTER var used inside the main script, so I've added XDG_SESSION_TYPE=x11 to my crontab line and it worked very well.

0 env PATH=/home/dukercs/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin XDG_RUNTIME_DIR="/run/user/1000" XDG_SESSION_TYPE=x11 DISPLAY=:0 DESKTOP_SESSION=bspwm DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" /usr/bin/dwall -s room

Incredible thanks so much! I've been beating my head against the wall trying to figure this out off and on every few weeks. for a good few months. I learned a lot about how to log erros and stuff though, lol. I just couldn't find the missing puzzle piece until now! Thanks!