-2

I am trying to add a startup script in my GCP VM Instance to fetch data from a website (web crawler). I wanted to automate the crawling task following this answer. So, I added a startup script in my VM instance. The script looks like below:

#! /bin/bash

python3 /home/sadmanks/site-spider/src/main.py

Then, I wanted to schedule this instance. But when executing this startup script, it doesn't start the program that I want to execute. The log message that I get is following:

"Error restarting service: Failed to try-restart nscd.service: Unit nscd.service not found

I tried to do this in the browser ssh connection: sudo service nscd start outputs:

Failed to start nscd.service: Unit nscd.service not found.

Does anyone have any idea, how to resolve this issue?

Note: The program runs perfectly when I try to connect the instance with an SSH to my local machine.

sksoumik
  • 845
  • 1
  • 9
  • 23
  • This barely is GCP related, when running faulty scripts. Common sense might suggest to install NSCD. – Martin Zeitler Jan 31 '22 at 05:03
  • Why are you trying to manage the Name Service Cache Daemon? That service is not related to python, web scraping/crawling, etc. Perhaps you are confusing that service with DNS? Make sure you know what your program is doing before running it on public servers. – John Hanley Jan 31 '22 at 06:55
  • Yes, both of you are right. I could ignore those error messages for my task. – sksoumik Feb 01 '22 at 16:06

1 Answers1

1

The error "Error restarting service: Failed to try-restart nscd.service: Unit crond.service not found." is just harmless log spam. These error messages show up on every VM on start-up and are expected since systemd services like crond.service and nscd.service do not exist on COS. So, try updating the version of google-guest-agent service. But as suggested by @John Hanley that service is not related to python, web scraping/crawling, etc. So, make sure you know what the program is doing before running it on public servers.

Jyothi Kiranmayi
  • 2,090
  • 5
  • 14