Skip to main content
Topic: Help with scipt to change wallpaper just before shutdown ? (Read 364 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Help with scipt to change wallpaper just before shutdown ?

Hi there!

I am not sure if this is the right place to post this question, but this was the only sub-forum I found with a reference to scripts.

I am running open-rc and would like to change my wallpaper (automatically) before shutdown, but  my searches result in almost exclusively systemd cases.

I will appreciate any tips, maybe links ?

Thanks in advance!

Re: Help with scipt to change wallpaper just before shutdown ?

Reply #1
I guess you have to write openrc wallpaper_change script, put it in /etc/init.d and add it to shutdown runlevel:
Code: [Select]
sudo rc-update add wallpaper_change shutdown

Re: Help with scipt to change wallpaper just before shutdown ?

Reply #2
@Ambie :  Thanks for prompt answer!   

This was exactly the info I was looking for. I will now  start looking into how  to write the script.


Re: Help with scipt to change wallpaper just before shutdown ?

Reply #4
@nous: Thanks!

Re: Help with scipt to change wallpaper just before shutdown ?

Reply #5
Quote
posted by @Ambie: I guess you have to write openrc wallpaper_change script, put it in /etc/init.d and add it to shutdown runlevel:
 

I wrote a script and placed it in ''/etc/init.d/':
Code: [Select]
~$ less /etc/init.d/byt_wallppr.sh
#!/bin/sh
sudo  xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorLVDS1/workspace0/last-image -s /usr/share/backgrounds/xfce/paltanen.jpg

Tried to add it to shutdown runlevel:
Code: [Select]
~$  sudo rc-update add /etc/init.d/byt_wallppr.sh  shutdown
 * rc-update: service `/etc/init.d/byt_wallppr.sh' does not exist

changed perms:
Code: [Select]
$ sudo chmod 770 /etc/init.d/byt_wallppr.sh

still:
Code: [Select]
$  sudo rc-update add /etc/init.d/byt_wallppr.sh  shutdown
 * rc-update: service `/etc/init.d/byt_wallppr.sh' does not exist


Code: [Select]
~$ ls -l  /etc/init.d/byt_wallppr.sh 
-rwxrwx--- 1 root root 147 17 feb 21.56 /etc/init.d/byt_wallppr.sh

Don't know what. Is there anything wrong with my script? Have I missed any typo????????

Re: Help with scipt to change wallpaper just before shutdown ?

Reply #6
Wonder whether it would be better to move this thread to subforum Open-rc and in that case how does one move it?

Re: Help with scipt to change wallpaper just before shutdown ?

Reply #7
That's not a valid openrc script.

It needs to call openrc-run with the shebang a la
Code: [Select]
#!/usr/bin/openrc-run

This is one I use to call another script which sets up my fans at boot
Code: [Select]
#!/sbin/openrc-run

name=$RC_SVCNAME
command="/usr/local/bin/fanspeed"
command_args=""
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
  after modules
}
It could be better I guess as openrc complains about it at shutdown but it works.
It might make more sense to pick a new wallpaper at boot rather than shutdown as openrc will be terminating things and unmounting.
You could just use rc.local to run your command if you struggle with the script.

 

Re: Help with scipt to change wallpaper just before shutdown ?

Reply #8
Quote
posted by @gripped:
It needs to call openrc-run with the shebang a la
Code: [Select]

#!/usr/bin/openrc-run

Thanks @gripped !!!!!  Had been searching for this info for a couple days!

I will try at boot.