Results 1 to 7 of 7
Hello!
First of all, I'm sort of a newbie to Linux, I've just started studying a few months back...
I'm trying to write a script that starts TightVNC Server when ...
- 12-11-2008 #1Just Joined!
- Join Date
- Nov 2008
- Posts
- 4
Script for launching an app at startup
Hello!
First of all, I'm sort of a newbie to Linux, I've just started studying a few months back...
I'm trying to write a script that starts TightVNC Server when the Linux system starts. I'm using Ubuntu at home but I have to do this for a Debian machine...
I've read some stuff about runlevels and how runlevels behave in Debian so I wrote a script containing just the command for launching tight vnc, I placed this script in the init.d folder in /etc/ and I placed a symbolic link to it in the /etc/rc5.d directory but when I rebooted the system (or when I typed "init 5" in the terminal)...nothing happened, my script did not run successfully. Before doing this, I tested the script manually and it worked, it launched my application.
Am I doing anything wrong? Am I doing anything right?
In the init.d folder I found a file named skeleton that said that scripts in that directory should look like that, but that was a complicated script for me so I ignored it, can anyone maybe help me decipher that? if that's what I need to do so that my script will run...
- 12-11-2008 #2Linux User
- Join Date
- Jun 2007
- Posts
- 318
What's the name of the symlink in /etc/rc5.d? It has to follow a certain format which is:
S##<name>
where:
S is the letter 'S' for start
## is a number from 01 to 99 which is the order of execution
<name> is (usually) the name of the script
Look at the other symlinks in /etc/rc5.d/ to get the idea.
- 12-11-2008 #3Just Joined!
- Join Date
- Nov 2008
- Posts
- 4
yes, it's named correctly, i chose the number for the order of exec randomly though...15 or something like that because it was free.
So the name of the symlink is S15vnc...
- 12-11-2008 #4Just Joined!
- Join Date
- Nov 2008
- Posts
- 4
yes, it's named correctly, i chose the number for the order of exec randomly though...15 or something like that because it was free.
So the name of the symlink is S15vnc...
- 12-11-2008 #5Linux User
- Join Date
- Jun 2007
- Posts
- 318
Well then, here's some thoughts on how to debug this:
1) Try manually running the script using the symlink to make sure that's set up correctly.
2) Try using a higher number like S95vnc... in case it needs something else that hasn't been started yet. You can use a no. more than once so if there's already a S95 it's not a problem.
3) Put some echo's like 'echo "I am here 1" >> /tmp/vnc.log' to see if the script is being run during startup.
I'm not familiar with Debian but check /var/log/messages for any error messages. Also, always use full path names for commands in startup scripts. Your PATH is probably is not the same as during startup.
- 12-12-2008 #6Just Joined!
- Join Date
- Nov 2008
- Posts
- 4
1) tried that, it works
2) i renamed with S99
3) i placed the echo, if i run the script manually it places my echoed string in the file
I also used absolute paths...
But it's still not working...maybe it's the script
Here's my script: (i used firefox not vnc as a test app for this)
#!/bin/bash
echo `date`:"i'm the firefox.sh script." >> /tmp/firescript.log
/usr/bin/firefox
- 12-12-2008 #7Linux User
- Join Date
- Jun 2007
- Posts
- 318
Well I'm not sure then since I don't use Debian, I use Red Hat. A little Google and I found a utility on Debian called update-rc.d. Maybe look into that. Even found a video about it.
YouTube - Debian Startup Scripts
I know in Red Hat you need a symlink at each run level and that's done with chkconfig.
Hope this helps.


Reply With Quote