Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
15
rated 0 times [  15] [ 0]  / answers: 1 / hits: 3962  / 2 Years ago, thu, october 27, 2022, 7:39:37

As said before we are running more than 500 ubuntu PC's in our company. Often we used to set our company ads as a wallpaper in clients machine. It is difficult for us to change wallpapers in all these machines one by one & also it is difficult for us to execute script in every machine through SSH to change the wallpaper. Is there a way to setup a server like if we change the wallpaper in the server it should be effected in all clients machine. If it is possible, it will save our time and effort. Can anyone help? Thanks in advance..


More From » server

 Answers
4

Set up a cron job on all machines that executes a script where you check 1 specific place for new images. Sample (untested) script with wget and ftp:



#!/bin/bash
wget -N -r -nH --cut-dirs=2 -t 180 -P /tmp ftp://user:[email protected]/dir/backgroundimage.gif
gconftool-2 --type string --set /desktop/gnome/background/picture_filename /tmp/backgroundimage.gif


Basically the 2nd line needs to be altered to the method you use to manually load the image to the machines. And then set up cron to execute this script to check every hour or once a day for new images.



You could even set it up to fetch a script where that script gets excecuted on the client machine and it then fetches the images and changes the background with gconftool-2. This would allow you to execute more than changing a background.






You can create a cron job with sudo crontab -e. This will show a line similar to this:



# m h  dom mon dow   command


(m minutes, h hour, dom day of month, mon month, dow day of week)
and underneath it you could add ...



0 * * * /path/to/executable


or



@hourly     /path/to/executable


to have /path/to/executable run every hour on the hour. Mind you: a script you put in here does not understand the path variable unless you include it. You can put this at the top to include $SHELL and $PATH:



SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin


Otherwise you need to make sure your script uses full path names to execute commands. More info on cron can be found on the Ubuntu wiki.



You can also use the /etc/cron.hourly directory to put a script there that gets run every hour. Example topics regarding the last part: What's wrong with my cron.hourly configuration? and Cron.hourly won't run.


[#44313] Friday, October 28, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ranquctive

Total Points: 391
Total Questions: 103
Total Answers: 104

Location: South Sudan
Member since Thu, Feb 4, 2021
3 Years ago
ranquctive questions
;