3

Sorry if this is a dumb question but I'm a newbie with these things.
I want to run a chrome extension inside a VPS (DigitalOcean), I have managed to open Chrome and install the extension and is running fine.
Is there some way to warranty the chrome extension is running 24/7 (restart automatically if there is some crash in chrome, or system restart etc)

EDIT:
I have installed "xfce4 and tightvncserver" in my server, and using VNCViewer to access. I run chrome from there. But I'm not sure if Chrome will continue running when I close VNCViewer and also close the SSH Terminal (where I'm starting VNC).
I just want to make sure my chrome extension is running all the time.
I've found this: How can i automatically execute a script after automatic boot? but I cannot find that file (/etc/rc.local)

K7AAY
  • 16,864
  • 9
  • 45
  • 77
Enrique
  • 141
  • 1
  • 5

2 Answers2

1

Enrique's answer above is good, but here's another way.

As per https://help.ubuntu.com/stable/ubuntu-help/startup-applications.html.en you can configure what applications should be started at login, in addition to the default startup applications configured on the system. If Chrome is running, so are its extensions, so you need to launch Chrome at startup. Applications to autostart are typically located in the /usr/bin folder.

http://edoceo.com/gui/xfce-autostart-apps and https://superuser.com/a/1302626/264083 illustrate how to always launch apps at startup time in XFCE. You create a *.desktop file in /etc/xdg/autostart/ for global services (best choice here), and ~/.config/autostart/ for personal ones.

After you create one, it is "enabled" by default, although can still be disabled via xfce4-session-settings. Here's an example:

[Desktop Entry]  
Type=Application  
Name=Google Chrome   
Exec=/usr/bin/google-chrome  
Terminal=false  
K7AAY
  • 16,864
  • 9
  • 45
  • 77
  • I think I have ommited important information because I don't understand how to do that (I think I don't have gnome) Could you please read my edit? – Enrique Nov 01 '19 at 13:33
  • @Enrique Sorry I overlooked the XFCE4 reference. Answer reworked accordingly. – K7AAY Nov 01 '19 at 15:21
  • Do you know if XFCE (and hence Chrome) is stop when I kill VNCServer? because right now I'm starting Chrome from XFCE using VNCViewer, but when I kill VNCServer and restart it, I cannot see my Chrome open, I need to open it again – Enrique Nov 02 '19 at 13:18
  • Actually there is an easier way (to me at least), Applications > Settings > Session and Startup and configure Google Chrome command there. Thanks ! – Enrique Nov 04 '19 at 14:46
  • @Enrique To find if XFCE and Chrome still run after you kill VNCServer, look in /var/log/syslog and /var/log/messages after you close then reopen VNCserver or set up a cron job to email you those files after a few minutes' delay. – K7AAY Nov 04 '19 at 16:16
1

It seems in newest Ubuntu versions /etc/rc.local is not available anymore, here are three solutions; first two thanks to
https://www.linuxbabe.com/linux-server/how-to-enable-etcrc-local-with-systemd
1) Use systemd
2) Use crontab (Cron @reboot)
3) Applications > Settings > Session and Startup > configure Google Chrome command there

K7AAY
  • 16,864
  • 9
  • 45
  • 77
Enrique
  • 141
  • 1
  • 5
  • It's OK to add to your own answer by clicking [edit] and updating it. It's also OK to click on the check mark to the left of the answer to show that was the answer you used. That shows folks the checked answer was the best. – K7AAY Nov 04 '19 at 16:13