Need help with a daily reboot cron job and question about MDADM

When I was using Linux Mint, I had the following cron job that would kick off every night at 10pm and use LuckyBackup to rsync my main mdadm array to a backup one. With EOS, I know I needed to install a cron app (I went with Cronie). I got that installed, enabled and started the service and LuckyBackup kicks off at 10pm and goes to work. No problem there.

Another thing I need, is for my system to do a reboot at 7:30am Mon, Tue, Wed, Thu, Fri, Sat. So I added the line from my Mint crontab right below the one for LuckyBackup but my system didn’t reboot at 7:30am this morning:

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ luckybackup entries ~~~~~~~~~~~~~~~~~~>
0 22 * * *      env DISPLAY=:0 /usr/bin/luckybackup --silent --skip-critical /h>
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end of luckybackup entries ~~~~~~~~~~~~~~>
30 7 * * MON,TUE,WED,THU,FRI,SAT shutdown -r

What am I doing wrong? When I opened a terminal and typed ‘shutdown -r’, it restarted seconds later.

Hmmmm… I just remembered something… in Mint, the daily reboot line… it DID have a path in front of ‘shutdown’. Something like, /usr/sbin/shutdown … but in EOS, I think I popped open a terminal and didn’t find that path or shutdown wasn’t in there… SOMETHING made me change the line to just ‘shutdown’ and remove the path. Maybe this is why it failed?

I’m going to do some Googling to see how to write a SystemD service file that accomplishes the same, 6 day reboot.

As for the MDADM question… with Mint (and I think this is an MDADM thing and less of a Mint thing), the first Sunday of every month, MDADM does a consistency check on the array. I guess I’ll know soon enough but do I need to do anything special in EOS for that to happen or is my guess right that the check is just part of MDADM’s code and it will do it automatically no matter which distro I’m using? (That’s why I don’t reboot on any Sunday since I don’t want to disrupt the consistency check.)

EDIT: I think I want to stick with Cronie for this… for daily reboots ‘mon-sat’, would this go in the cron.daily folder or cron.weekly one?

hm i do no using cron jobs at all here, the only difference to ther distros may be related to that we use a more recent version of softwere like arch does:

https://wiki.archlinux.org/index.php/Cron#Cronie

must be daily as it should run daily ?

Thanks for replying but I got it figured. I tested it on my spare computer and it’s working perfectly. For future travelers, here’s what I did:

sudo crontab -e
30 7 * * mon-sat /bin/reboot >/dev/null 2>&1

I just put the command in root’s crontab and did some tests for like 6:30pm, 6:45pm and it restarted right on time!

Guess I’ll wait to see what happens on the first Sunday of next month regarding my MDADM question. :slight_smile:

1 Like

Hello, I’m new to Endevour OS. I don’t have problems with crontab in other distros I use. Just put crontab -e in terminal and it works. Now I see that:


~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/tmp/crontab.MOkIhp" 0 lines, 0 characters

I cannot edit that.
Regards,

Press i, it is opened in vi by default :slight_smile:

Thanks for answer. Can I open it in nano: sudo nano crontab -e?
and make it looks that?

#At minute 10 past every 2nd hour
10 */2 * * * systemctl restart couchpotato.service

Regards.

Archwiki says:

By default the crontab command uses the vi editor. To change it, export EDITOR or VISUAL , or specify the editor directly: EDITOR=vim crontab -e

Just use nano instead of vim

I recommend “micro” :wink: :slight_smile:
Even easier to handle.

Thanks @SGS bit I already know nano and it’s good for me.
@Tasia91 Hi, I make crontab entry with: sudo EDITOR=nano crontab -e and reboot but how can I check that is working?

You can check it with crontab -l. But since you created it with sudo, it is probably root’s cronjob?
Also it is probably necessary to enable cronie.service as well.

Itś from AUR though, EOS provides only vi and nano by default :slight_smile:

2 Likes

Thanks. I keep forgetting that the Librewish micro-git is building for me in chaotic aur. :wink:

1 Like

I use with sudo becaause I have to type in terminal: sudo systemctl restart couchpotato.service. Cronie service is working because I have to install it to timeshift work.
I see when I type:
sudo crontab -l
Thanks for help.

1 Like