Created
May 29, 2023 21:02
-
-
Save atakde/1cddab4cd99a446045bf34c984e80659 to your computer and use it in GitHub Desktop.
Run process if not runs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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