Check my upstart script code?
Israel
israeldahl at gmail.com
Wed May 13 12:30:56 UTC 2015
Hi John
(inline)
On 05/09/2015 03:47 PM, John Hupp wrote:
> ..
> Here is an improved upstart job (/etc/init/pcmanfm-ltsp.conf). The
> script code is tested as working when run manually as a script, but it
> was not effective as an upstart job. Perhaps environment variables
> like $HOME are not available to upstart jobs even though this one
> doesn't run until after the desktop session has started and $HOME
> should be defined at that point.
>
You could try setting something like:
MY_HOME=$(xdg-user-dir HOME)
sed -i 's/mount_removable=0/mount_removable=1/'
"$MY_HOME/.config/pcmanfm/lubuntu/pcmanfm.conf"
You could also save the script as a file in your $PATH (like /usr/bin)
and use:
exec scriptname
in your conf file
But this is maybe more of a style preference thing :)
> But given that the code works as a script, I can probably get what I
> want by setting that up with a desktop shortcut in an autostarting
> location.
>
> # Edit pcmanfm Volume Management preferences at startup
> #
> # Set prefs based on whether the machine is a thin client or a
> server/fat client
>
> description "Edit pcmanfm Volume Management preferences based on
> machine type"
>
> start on desktop-session-start
>
> script
> # test for a fat client:
> if [[ $(hostname | grep 'ltsp') == ltsp* ]]; then
> sed -i 's/mount_removable=0/mount_removable=1/'
> "$HOME/.config/pcmanfm/lubuntu/pcmanfm.conf"
> # test for a thin client:
> elif [ -n "$LTSP_CLIENT" ]; then
> sed -i 's/mount_removable=0/mount_removable=0/'
> "$HOME/.config/pcmanfm/lubuntu/pcmanfm.conf"
> # machine must be the server
> else
> sed -i 's/mount_removable=0/mount_removable=1/'
> "$HOME/.config/pcmanfm/lubuntu/pcmanfm.conf"
> fi
> end script
>
>
--
Regards
More information about the Lubuntu-users
mailing list