Skip to content

Instantly share code, notes, and snippets.

@atakde
Created May 29, 2023 21:02
Show Gist options
  • Save atakde/1cddab4cd99a446045bf34c984e80659 to your computer and use it in GitHub Desktop.
Save atakde/1cddab4cd99a446045bf34c984e80659 to your computer and use it in GitHub Desktop.
Run process if not runs
#!/bin/bash
# Define the process name to monitor
process_name="chrome"
# Check if the process is running
if pgrep -x "$process_name" >/dev/null; then
echo "Puppeteer script is running."
else
echo "Puppeteer script is not running. Starting it..."
# Replace the command below with the command to run your Puppeteer script
# For example, if you're running your Puppeteer script using the `node` command:
# node /path/to/your_script.js
# If your Puppeteer script launches Chrome directly, you can specify the path to the Chrome binary
# /path/to/chrome --args /path/to/your_script.js
# Add your command here:
# */5 * * * * /path/checker.sh >> /path/logfile.log 2>&1
echo "Puppeteer script started."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment