More
referral
Increase your income with Hive. Invite your friends and earn real cryptocurrency!

CronJob - Where to Identify / crontab -e Does not work

Dear Devs,

Can you please advise how to add a cronjob to HiveOS ? crontab -e command to edit the tasks does not work since it pulls the file from TMP location.

Thanks for the advices

for permanent changes edit file /hive/etc/crontab.root

3 Likes

thx !

but it is deleted when you restart

2 Likes

Tried editing using:
[email protected]:/hive/etc# crontab.root -e
and get:
bash: ./crontab.root: Permission denied

I’m able to edit using vi and nano, but nothing happens when added the following commands to end of the file (just trying to stop on 1st minute and start on 4th for testing):
#stop miner
1 * * * * /hive/bin/miner stop

#start miner
4 * * * * /hive/bin/miner start

Thank you for your help!

You must be thinking that editting /hive/etc/crontab.root is the same as running the command sudo crontab -e to edit the crontab are the same. I have confirmed that on my system, if you use sudo crontab -e, your changes will be lost at reboot, but if you add your changes to /hive/etc/crontab.root, any changes made will saved in remain in the crontab after reboot.

Indeed, I am total hive noob. Thought editing crontab.root with nano or vim is same as with -e?

If I use command, /hive/etc/crontab.root -e

Returns, bash: ./crontab.root: Permission denied

Were you able to edit with nano? ‘nano crontab.root’ is the command when in the /hive/etc/ directory.

Yes, was able to edit the file using nano crontab.root but this did not work.

It has been a while, will try process again this weekend and update.

Update… 16/03/19

Sorry for the late reply! Got this to work today. Edited crontab.root with nano. Added commands as mentioned above. Made sure no extra spaces anywhere. Seems to be working!

Thank you for help!
Happy mining!

Also to mention, think this wasn’t working for me at first because forgot to reboot after changing the crontab.root. Once did this all is working fine.

Works fine using nano crontab.root

Just reboot after changing for changes to take effect. Will need to change crontab.root file after upgrading hiveos to latest.