PDA

View Full Version : [gnome] Startup Script



ShareBuntu
August 21st, 2008, 07:09 AM
Hi,

I'm running a script 10 minutes after every hour using cron through crontab:


#!/bin/bash
wget http://www.opentopia.com/images/cams/world_sunlight_map_rectangular.jpg -nc -O /home/null/sight/wallpaper/world_map.jpg
gconftool-2 --unset /desktop/gnome/background/picture_filename
gconftool-2 --type String --set /desktop/gnome/background/picture_filename "/home/null/sight/wallpaper/world_map.jpg"

What I want to do is have the same script execute every time I launch X or GDM so that I have an updated background waiting for me upon login. How would I materialize this unobtrusively - i.e. no delays waiting for it to download before I can use my desktop?

prshah
August 21st, 2008, 09:44 AM
What I want to do is have the same script execute every time I launch X or GDM so that I have an updated background waiting for me upon login. How would I materialize this unobtrusively - i.e. no delays waiting for it to download before I can use my desktop?

Add the script to your startup sessions (System-Administration (or Preferences?)-Sessions); it will be backgrounded automatically (eg, no need to add "&"). You can also start it up with a modified nice priority (lower priority), by using the "nice" command.

Post back if you want more details.

Loaded.len
August 21st, 2008, 09:47 AM
you could also save your code as /etc/xprofile and make it executable.

Don't know if that will cause the delay you are concerned about, though.

ShareBuntu
August 21st, 2008, 09:52 AM
Add the script to your startup sessions (System-Administration (or Preferences?)-Sessions); it will be backgrounded automatically (eg, no need to add "&"). You can also start it up with a modified nice priority (lower priority), by using the "nice" command.

Post back if you want more details.
Do I have other options besides "nice"? I presume the command would be "nice /usr/local/bin/wallpaper" - given that wallpaper is executable and exists?

prshah
August 21st, 2008, 10:38 AM
Do I have other options besides "nice"? I presume the command would be "nice /usr/local/bin/wallpaper" - given that wallpaper is executable and exists?

Oooer; if you're placing it in /usr/local/bin, ensure that your user can execute it
sudo chmod o+x /usr/local/bin/wallpaper I would just place that script in a .scripts/ directory in the home folder... but maybe you're looking at other users on the system using it as well.

The correct format will be
nice -n 15 /usr/local/bin/wallpaper You can go upto 19 but then it will be very leisurely executed, probably only when the computer goes idle. The default nice "level" is 10, near-realtime -20, and near-idle-time 19. (Yes, the levels are skewed).

ShareBuntu
August 21st, 2008, 11:40 AM
Thanks for the help. It worked perfectly. :)