Why won't my script run?
Martin Laberge
mlsoft at videotron.ca
Sat Mar 14 19:12:38 UTC 2009
On Saturday 14 March 2009 13:07:21 Mark Greenwood wrote:
> Another question for the boffins..
>
> My Acer Aspire One needs a special script to control the fan. This script is called /usr/local/bin/acerfand and, when I run it from the command line it does indeed control the fan. acerfand is a bash script which daemonises itself using magic I do not understand.
>
> To get it to start at boot I'm instructed to place the command line into /etc/rc.local, so ignoring comments my /etc/rc.local now looks like
>
> #!/bin/sh -e
> /usr/local/bin/acerfand
> exit 0
>
> If I run 'sudo /etc/rc.local' from the command line my fan script starts running, the fan is being controlled and I can see acerfand as a running process.
>
> On boot however, the script starts and then immediately exits (I put debug in, I can see it in syslog starting up and then exiting). There is no running process called acerfand after boot. Again, I type 'sudo /etc/rc.local' at a command line and now there is a running acerfand process.
>
> Why the different behaviour at boot, and how can I make it work?
>
> It worked on Mandriva.... ;)
>
> Thanks,
>
> Mark
>
The /etc/rc.local script is runned at the end of boot process.
Your script should run at this time.
BUT... You should check what environment variables are availables at this time.
Maybe one important one is missing, (rc.local has few environment set when runned)
then add to rc.local the init environment needed. (ex followed)
#!/bin/sh -e
MYVAR="myvalue"
HOME="/mypath/here"
WHATEVER="whatever other things you may need"
export MYVAR HOME WHATEVER
echo "Starting acerfand"
/usr/local/bin/acerfand || echo "wrong start of acerfand"
exit 0
This would surely help you do the right thing.
--
Martin Laberge
mlsoft at videotron.ca
Tel:(418)521-6823
30 Years of Unix Admin, and still learning...
More information about the kubuntu-users
mailing list