Answer the question
In order to leave comments, you need to log in
Running watch via sh, how?
Hello.
Given: 2 script.sh scripts whose purpose is to generate output from curl
Task: run two scripts at a specified frequency (2s)
Solution: run through watch
watch -n 2 "/root/script1.sh | tee -a 1.log" &>/dev/null &
watch -n 2 "/root/script2.sh | tee -a 2.log" &>/dev/null &
#!/bin/bash
if ! (pidof watch)
then
watch -n 2 "/root/script1.sh | tee -a 1.log" &>/dev/null &
watch -n 2 "/root/script2.sh | tee -a 2.log" &>/dev/null &
echo "Watch restarted" | mail -s "CRON: Watch was restarted" [email protected]
fi
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question