If you want a script that (for example) opens a web page, that is a post-login task, not a boot task. Very different.
All boot tasks (including rc.local and cron @reboot) must be headless - no display. Boot output is logged instead of displayed.
Any display-related actions or scripts before login will always fail, regardless of how you initiate them. Including rc.local and cron.
Reason: The display server isn't started until after login is successful.
Instead, try putting your script in your ~/.config/autostart/ directory.
Items in ~/.config/autostart/ are run after login, after the display server and Desktop Environment are up and running.
The script should run without sudo. Items run as your user, since they are within your user's environment.
When troubleshooting startup scripts of any kind, outputting debug messages to logfiles (instead of the screen) can be a very handy technique to find the problem.
Last edited by ian-weisser; November 29th, 2015 at 09:30 PM.
Is basically, the script has to run and thats it.
Because, if it runs successfully automatically, then the job is done.
When it runs, then the process starts.
I test it by going to a URL. If it opens, that means the process is running. If its not, that means its not working.
So where to place finally ?
That kind of test will only work from an active graphical log in. What you might do is put something in your script that does not need a graphical login to see if it has run. Try adding at the end of your script, something like this:
and then see if there is a file called /tmp/foo.txt after you boot.Code:/bin/date > /tmp/foo.txt
Here is what I do now :
When the server reboots, i do this :
cd /usr/software
then
./ooklaserver.sh start
Then it says, starting daemon and it starts and when I refresh the page on browser, its opening.
So, which file shall I paste this exact code ?
It would go in the file ooklaserver.sh
but can you run the script as /usr/software/ooklaserver.sh directly instead of using cd? Or must it be in the same working directory?
You mean edit ooklaserver.sh using sudo nano and enter what ?
Bookmarks