[Answered] cron restart all services

Hi all

How to write cron job to restart all dietpi services at 1 hour in the morning using crontab -e ?

Add the line:

  • 1 * * * /DietPi/dietpi/dietpi-services restart

This restarts services every day at 01:00 am system time.

Thanks

Does this still holds true?
Instead of every day i want this to run every minute so i changed it to
59 * * * * /DietPi/dietpi/dietpi-services restart > /var/log2.txt
this isnt running, and log2.txt is a blank file. Any help?

This means the cron job will run at minute 59.

What would be the reason to restart ALL services every minute?

I need this to be run every 59Min, (sorry for typo)

All services just include *Arrs with qbitt and dietpi-vpn. I dont monitor this setup quite often and once i do i found that all d/l are stuck coz no internet (probably vpn issue) and all *Arrs are throwing indexing errors. Then i just do dietpi-services restart and evrything works fine. So i thought to automate this “process”.

Use

59 * * * * /boot/dietpi/dietpi-services restart > /var/log2.txt 2>&1

So also errors are logged and the path to the script corrected (which changed).

Just in case: */n at first position is for running the job every n minutes.

2 Likes

UHHH something I totally overlooked. Well spotted.

how did you already knew that my next question would be "Why it only run once when i wanted to run every n minute? déjà vu I guess… Thank you!! This worked .