How to stop and restart Crontab service when something is wrong
After I've completed my first working Python script, the last step was to automate the script execution in my Ubuntu server via crontab. As a Unix sysadmin I thought this was a piece of cake but I made a noob error somehow.
Used * in the minute column of entry
* 18 * * * /home/ubuntu/miniconda3/bin/python /home/ubuntu/vornix_posting_bot.py >> /home/ubuntu/logs/vornix.log 2>&1
This was what I added in the crontab file with simple command just to execute the script and output errors into a log fine. The execution time was ideally plan to be at 1800 every day. Note that the first *
here was representing the minute.
Luckily I did not put the script into produection straight away as the next day I found out crontab was executing the command once every single minute.
Solutions
Huge mistake and here is what I have done to fix it:
- Apparently we need to fix the crontab syntax which is replacing the
*
with0
.
0 18 * * * /home/ubuntu/miniconda3/bin/python /home/ubuntu/vornix_posting_bot.py >> /home/ubuntu/logs/vornix.log 2>&1
- Secondly, changing the crontab file itself is not enough to stop crontab service to keep executing the old command which is repeating every minute and I have no idea when it will be ended. Restart the
cron
service byservice cron restart
in Ubuntu OS and check the status withservice cron status
. The previous job should be ended now.
Posted from my blog with SteemPress : https://fr3eze.vornix.blog/how-to-stop-and-restart-crontab-service-when-something-is-wrong/
i dunno anything about this but thanks for sharing! 😆
i hope you're enjoying your monday!
Taken a day off today to extend the weekend, just gotta find ways to trick myself into the "I-dont-have-a-job-so-I-can-do-whatever-shit-I-want-to-do" thinking you know LOL. Dont worry about the system administrating code, your indie game development's difficulty is way more overwhelming.
haha i like how you're tricking yourself. if you can completely shut off work and be at peace, it's awesome 😎👍
as for me, i just couldn't do it 😆
To me, there is no peace idling around for a long hours without working something out. The guilt of wasting time would be overwhelming. There is only one way to keep me unproductively busy so far, and that is gaming all day long haha.
Hello! Your post has been resteemed and upvoted by @ilovecoding because we love coding! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On!
![](https://steemitimages.com/640x0/https://codingforspeed.com/images/i-love-coding.jpg)
Reply !stop to disable the comment. Thanks!
To listen to the audio version of this article click on the play image.
![](https://steemitimages.com/640x0/https://s18.postimg.org/51o0kpijd/play200x46.png)
Brought to you by @tts. If you find it useful please consider upvoting this reply.
Hi @fr3eze!
Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 4.039 which ranks you at #3509 across all Steem accounts.
Your rank has improved 9 places in the last three days (old rank 3518).
In our last Algorithmic Curation Round, consisting of 230 contributions, your post is ranked at #196.
Evaluation of your UA score:
Feel free to join our @steem-ua Discord server
Congratulations @fr3eze! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
Click here to view your Board of Honor
If you no longer want to receive notifications, reply to this comment with the word
STOP
Do not miss the last post from @steemitboard: