Answer the question
In order to leave comments, you need to log in
Multiple launch of the script for no reason, where did you go wrong?
Good day experts!
I have a telegram bot written in python. In the bot's location folder, I created a crontab.sh file with the following content:
#!/bin/bash
if [ "pgrep -f bot.py" != 0 ]
then {
sleep 1 #delay
/usr/bin/python3.6 /home/usertest/bot.py
exit 1
}
else
{
echo "Exit! Python bot is already running!"
exit 1
}
fi;
chmod u+x /home/usertest/crontab.sh
crontab -e
*/5 * * * * /home/usertest/crontab.sh
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