Trouble spawning processes under a bash script

Hey Folks,

I am running Opensuse 11.1, gnome environment.

Right now I have a bash script that is launched at startup via sessions. This script has two simple commands: 1) sleep until the desktop environment has loaded up, and 2) execute a launch of a custom program.

The trouble is that when running my custom program this way it is unable to open a media player as part of its functionality (the program uses the function g_spawn_async_with_pipes() to launch beep media player). However when I run the custom program on its own, through a terminal command, it can launch the media player as desired. I’m not sure how to fix this problem. How can I launch the program with this script, and still have the functionality to spawn child processes?

My simple script:


#!/bin/bash
sleep 30
TEMP=`sudo ./programdirectory/custom_program`
exit


Thank you for your time, its much appreciated.

You should probably use

sudo /absolute/path/to/custom_program

because the current directory may be different for different invocations.

Also why:

TEMP=`...`

? As far as I can see you don’t use TEMP. Why do you want to use the backtick construct? Why not just

sudo /absolute/path/to/custom_program

?

Thanks for the tips, what does the back tick construct do?

It substitutes the output of the command into that place in the command line. In your case it assigns the output to TEMP.