I installed Cronie, but having a problem using it. I’d like to use it to reboot the computer every day at a certain hour. Anyway, running crontab -e in Terminal, I get this:
Welcome to the Haiku shell.
~> crontab -e no crontab for user - using an empty one /bin/sh: line 1: /usr/bin/vi: No such file or directory crontab: “/usr/bin/vi” exited with status 127 ~>
I think the error is related to cronie trying to use Linux’s Vi text editor, which doesn’t exist in Haiku. I can manually create and edit a crontab file, but I don’t know where to create it. Can anyone assist? Thanks
Vim is largely vi compatible, mostly extending the features. Given that cronie most likely only wants to open a temporary crontab file with it it don’t expect any compatibility issues. But that’s only guessing, the OP will have to try it out. And if it works maybe vim should be included in the dependencies for cronie.
Thanks for letting me know
Let’s not get into nitpicking wars on Easter Sunday, shall we? As I wrote above, cronie most likely wants to call vi to simply open the crontab file. I don`t expect any vi vs. vim compatibility issues doing that.
The missing editor doesn´t seem to be the only problem with cronie. I have vim installed and get these errors:
~> crontab -e
/packages/cronie-1.5.2-2/.self/var/spool/cron: No such file or directory
/packages/cronie-1.5.2-2/.self/var/spool/cron: mkdir: No such file or directory
Looks like cronie wants to create the crontab file within the package itself, which obviously doesn´t work. This is not surprising because looking at the haikuports recipe there is no patch applied that does anything to point cronie at the right spool directories on Haiku (or at least I didn´t find any).
I think we really should have an integrated task scheduler on Haiku that can be configured via GUI to avoid having users messing around with cron-like programs. Sure, a having a task scheduler is probably not a high priority on a desktop OS but very useful sometimes nonetheless.
@kp3ft : There was a discussion about something similar on the forum a while ago, where a script was posted that runs in a loop and mimics the behaviour of a simple task scheduler. Maybe this could be a workaround for you for the time being.
Yeah, that was probably one of my previous posts. I need the Haiku computer to reboot at a particular time every very early morning. Some folks posted some scripts to try, but I couldn’t get them to work.
It works! I did export EDITOR=nano and then crontab -e . Added a reboot statement in the crontab file and saved it. Computer rebooted right on schedule.
What worked for me to get Cronie working:
Install Cronie from the package manager.
2.Run in Terminal: mkdir -p /boot/system/var/spool/cron ln -sv /bin/crond ~/config/settings/boot/launch/crond
Reboot (might not be necessary, but I rebooted anyway.)
It probably should exist. It’s one of the BeAPI find_directory constants(B_SYSTEM_SPOOL_DIRECTORY). Then there would be no need to modify the cronie code.
Ok, so now at command is available, at least for x86_64.
(When I requested here above to be available – I was still on 32 bit Haiku.)
~> pkgman search atd -D
Repository Name Version Arch
------------------------------------------------------
<system> at 3.2.5-1 x86_64
HaikuPorts at 3.2.5-1 x86_64
HaikuPorts matio 1.5.26-1 x86_64
HaikuPorts matio_debuginfo 1.5.26-1 x86_64
HaikuPorts openjdk11_default 11.0.9.11-1 x86_64
HaikuPorts openjdk12_default 12.0.1.12-1 x86_64
HaikuPorts openjdk13_default 13.0.2.8-4 x86_64
HaikuPorts openjdk14_default 14.0.2.12-1 x86_64
HaikuPorts openjdk15_default 15.0.1.9-2 x86_64
HaikuPorts openjdk16_default 16.0.2.7-2 x86_64
HaikuPorts openjdk17_default 17.0.7.3-2 x86_64
HaikuPorts openjdk8_default 1.8.u242_b8-4 x86_64
HaikuPorts texlive_mathscience 2023-2 any
~>
~> pkgman search atd
Status Name Description
--------------------------------------------------------------------------------------------
S at Queues jobs for later execution
matio Library for reading and writing matlab files
matio_debuginfo Library for reading and writing matlab files (debug info)
openjdk11_default An open-source implementation of the Java Platform, SE
openjdk12_default An open-source implementation of the Java Platform, SE
openjdk13_default An open-source implementation of the Java Platform, SE
openjdk14_default An open-source implementation of the Java Platform, SE
openjdk15_default An open-source implementation of the Java Platform, SE
openjdk16_default An open-source implementation of the Java Platform, SE
openjdk17_default An open-source implementation of the Java Platform, SE
openjdk8_default An open-source implementation of the Java Platform, SE
texlive_mathscience TeX Collection: Mathematics, natural sciences, computer scienc…
~>
As I installed and after started to try out, but as at daemon/service - atd - had not run, I got error message as it seems does not run.
Checked with ps, it was true.
This way I started - manually - using nohup, I could see its team with ps
~> ps atd
Team Id #Threads Gid Uid
/boot/system/bin/atd 50626 1 106 1004
Thread Id State Prio UTime KTime
atd 50626 zzz 10 1 6
~>
It started successfully - it went as expected.
However,
is there a way to launch it automatically as a service ?
The package includes a script that should start it at boot, but it does not start as soon as you install the package. You must reboot first. After that, you should be able to see a job using the launch_roster command, for example: launch_roster info x-vnd.at-atd
I was the one that recently updated cronie and added the at recipe. I’m not sure I want to take credit for the at recipe because it was a really quick hack job on the source code in order to make it work. I need to go back and redo it at some point.
Also, the new cronie package now includes a startup script, similar to atd. You can use launch_roster info x-vnd.cronie-crond to get information about it.
I assume this also needs a reboot to be registered, as actually …
~> launch_roster info x-vnd.at-atd
launch_roster: Could not get target or job info for "x-vnd.at-atd": Name not found
~> launch_roster info x-vnd.cronie-crond
launch_roster: Could not get target or job info for "x-vnd.cronie-crond": Name not found
~>
I would re-check once I rebooted Haiku.
Thanks for info and update on it.
Also you can take the credit as at command worked on programs - I could start them scheduled.
Also for myself it was a good round – learnt the atq and atrm commands … visiting an at command wiki page.
… after jobs had not worked for me, at least as I rmembered it should be done … so later I must re-iterate to grok into my puffer :))