go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.
https://go-rod.github.io
MIT License
5k stars 328 forks source link

Just a recipe to run a go-rod program as systemd service #1064

Open chmike opened 1 month ago

chmike commented 1 month ago

Rod Version: v0.116.0

I wrote my first go-rod program using Chromium that works fine. I then wanted to run it nightly and this is when the trouble started as we can’t launch chromium from a cron job due to systemd cgroup sandboxing when chromium is a snap for instance as it is on Ubuntu.

After some research and testing I found the solution. You may want to post a reference to it in your FAQ in case someone experience the same problem as me.

Here is the link to the askubuntu question.

ysmood commented 1 month ago

I also did something similar, but the approach is different. I use the golang cron job library and docker, if you use docker restart=always it will survive after system reboot.