WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How do you run a script at startup  (Read 6548 times)

Offline nam

  • Newbie
  • *
  • Posts: 6
How do you run a script at startup
« on: January 15, 2013, 10:00:12 AM »
I've got a Tiny Core setup on a VMWare and plan on using it as a Selenium Node.
So far, I've installed JAVA, Chrome, Chromedriver, and Selenium on this machine.  I'm able to launch the the Selenium jar from the terminal and it all works fine.  To put the final finishing touch to this setup, I need to start the selenium jar on startup, but I'm having difficulty figuring it out.  The commands to start the selenium is like this:

java -jar /path/to/selenium/server/selenium-server-standalone-2.28.0.jar -role node -nodeConfig /path/to/selenium/config/cofigFile.json

I'm a newbie to linux and tiny core so I may need some hand holding.
So far, I've tried to put this exact line in a shell script (runSelenium.sh), but no matter where i put it, it is not executed.  Any suggestion would be great.
By the way, I'm not even sure if putting this line in a shell script is the best way to do this.

Thanks.

Offline spence91

  • Jr. Member
  • **
  • Posts: 80
Re: How do you run a script at startup
« Reply #1 on: January 15, 2013, 10:13:46 AM »
Hi - there's a piece in the Wiki that tells you what you need to know:

http://wiki.tinycorelinux.net/wiki:bootlocal.sh_and_shutdown.sh

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: How do you run a script at startup
« Reply #2 on: January 15, 2013, 10:16:14 AM »
Add it to /opt/bootlocal.sh It is executed as root at the end of boot process when extensions are already loaded. Use absolute path when files specified.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline nam

  • Newbie
  • *
  • Posts: 6
Re: How do you run a script at startup
« Reply #3 on: January 15, 2013, 10:59:24 AM »
Thanks for the quick reply.  I've tried putting something like this in the bootlocal.sh:

/path/to/my/script.sh

but when I check, it doesn't seem to be running.  I've also tried to put the entire java -jar... script inside the bootlocal.sh.  Still no luck.  I've checked it using:

ps | grep java
and
sudo lsof -i | grep port#

Neither of these commands list the java process.

Do these boot script run after the GUI is loaded?  Since selenium runs GUI automation test, I would expect that UI is required.  I'm just throwing out ideas here.

Offline nam

  • Newbie
  • *
  • Posts: 6
Re: How do you run a script at startup
« Reply #4 on: January 15, 2013, 11:05:18 AM »
Found the answer.  I put my script in /home/tc/.X.d folder.  I think the scripts in this folder is executed after everything else is execute.

http://wiki.tinycorelinux.net/wiki:the_boot_process

Thanks for your help!!!

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11586
Re: How do you run a script at startup
« Reply #5 on: January 15, 2013, 11:18:44 AM »
Hi nam
Actually those are not scripts. The command in the file is read by .xsession and executed. I think I remember
reading somewhere in the forum that you are limited to one command per file, but I'm not certain of this.

Offline nam

  • Newbie
  • *
  • Posts: 6
Re: How do you run a script at startup
« Reply #6 on: January 15, 2013, 11:34:45 PM »
inside the script file in the .X.d folder, I've added one line.  A line referencing another script, which launches the java application.