Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems setting wallpaper from cron or as sudo #57

Open
MDabrowski9LD opened this issue Apr 26, 2019 · 5 comments
Open

Problems setting wallpaper from cron or as sudo #57

MDabrowski9LD opened this issue Apr 26, 2019 · 5 comments

Comments

@MDabrowski9LD
Copy link

When invoking simple script that should change wallpaper with sudo ie: sudo /abs/path/script.js or from cron * * * * * /abs/path/script.js wallpaper stays the same. When called manually and without sudo/cron it works as intended.

Any ideas what might be wrong?

@sindresorhus
Copy link
Owner

What OS, version, and Node.js version?

@MikeDabrowski
Copy link

Linux mint 18 (cinnamon and sonya i think), node 11.10.1. Wallpaper installed globally, NODE_PATH pointing to node_modules where it is installed.
I use absolute path to image.
Added #! /usr/bin/node to the script and calling it only by name.

@MDabrowski9LD
Copy link
Author

I think I got it. Cron has limited env and in order to set wallpaper some env variables have to be exported. I found this https://askubuntu.com/a/198508 post and adapted to my case. It worked.

@sindresorhus
Copy link
Owner

Would you be willing to submit a PR to the readme with a tip about the above? I'm thinking a new Tips section at the bottom.

@MikeDabrowski
Copy link

Sure, how about I put my solution for daily wallpaper changer in examples folder ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants