Mario M.
Mario M.

Reputation: 872

Problems with Startup script - Compute Engine

I need to run a jar file when my Ubuntu 16.04 instance on GCP is ON. So I add a custom metadata:

enter image description here

but It's not working.

For testings, I have tried to generate files every time I turn off and on the VM, and startup script compiles them successfully.

EDITED: If I run this command from shell, it runs succesfully and port 4444 is opened.

Furthermore, the startup script ignores xvfb for the following example, but fuego_vins.txt and fuego_vins_exit.txt are deposited on /usr/bin:

#! /bin/bash
sudo touch /usr/bin/fuego_vins.txt
sudo apt-get update
sudo xvfb-run -a java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar selenium-server-standalone-3.13.0.jar -port 4444
sudo touch /usr/bin/fuego_vins_exit.txt

Upvotes: 0

Views: 842

Answers (1)

J.Rojas
J.Rojas

Reputation: 322

I tested it using:

  • xvfb version: xorg-server 1.18.4
  • selenium-server-standalone-3.9.1.jar

from /usr/bin/selenium

-rwxr-xr-x 1 root  root 153 Nov 27 08:31 run   
-rwxr-xr-x 1 user  user 23428464 Feb  7  2018 selenium-server-standalone-3.9.1.jar

I created script into /home/user folder into VM then I ran it from startup-script.

startup-script:

sudo apt-get update
sudo apt-get upgrade
sudo /usr/bin/selenium/run

from the Serial port 1 (console) output for instance:

Ubuntu 16.04.5 LTS instance ttyS0

instance-2 login: Nov 27 09:00:43 instance-2 startup-script: INFO startup-script: 2018-11-27 09:00:43.766:INFO::main: Logging initialized @2790ms to org.seleniumhq.jetty9.util.log.StdErrLog
Nov 27 09:00:44 instance-2 startup-script: INFO startup-script: 2018-11-27 09:00:44.100:INFO:osjs.Server:main: jetty-9.4.7.v20170914, build timestamp: 2017-11-21T21:27:37Z, git hash: 82b8fb23f757335bb3329d540ce37a2a2615f0a8
Nov 27 09:00:44 instance-2 startup-script: INFO startup-script: 2018-11-27 09:00:44.158:WARN:osjs.SecurityHandler:main: [email protected]@45ca843{/,null,STARTING} has uncovered http methods for path: /
Nov 27 09:00:44 instance-2 startup-script: INFO startup-script: 2018-11-27 09:00:44.166:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@45ca843{/,null,AVAILABLE}
Nov 27 09:00:44 instance-2 startup-script: INFO startup-script: 2018-11-27 09:00:44.230:INFO:osjs.AbstractConnector:main: Started ServerConnector@93c3e76{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
Nov 27 09:00:44 instance-2 startup-script: INFO startup-script: 2018-11-27 09:00:44.231:INFO:osjs.Server:main: Started @3256ms

I could not run it, with selenium-server-standalone-3.13.0.jar; so I'll try later. Hope it could be useful to you.

Upvotes: 1

Related Questions