At/atd missing:is there a way to have them^

As the subject says, I’ve just discovered that there’s no at/atd in IPFire, only fcron, but I need a one time scheduler for some tasks (in my case, a bash script which add or delete some rules at specific times).

Is there some pak file which provides them, or at least a compatible source package?

Thanks
Luca

No that package is not available within IPFire.

If you have to have the “at” package for your use case then the only option is to build and install it yourself as a personal add-on.

https://wiki.ipfire.org/devel/ipfire-2-x/addon-howto

With fcron there is the option to set a command to be run at a specified date and time. This would then only run that command once until the same date and time came round the following year.

Running that command and then having to delete the fcron command within the next year seems easier than trying to build the at package as a local addon.

2 Likes

Right, didn’t think about that (Monday, you know…). And, given that crontabs are usually overwritten during updates, the chance for a “one time” entry to survive 'til next year are quite small (and if one uses the day of the week field, too, next to zero).

Thanks for the suggestion.

Luca.

Just a reminder of the helpful cron pages:

https://cronprompt.com/

Best

2 Likes

you can always run right after your main script, a second script to comment out the fcron entry.

3 Likes

New problem, but related: I’ve just followed the instruction to create a dedicate “fcronuser” to avoid modifications to root’s
crontabs, only it doen’t work, e.g.:

# fcrontab -u fcronuser -e
(... insert commands & save)
2023-02-21 14:20:56  INFO fcrontab : editing fcronuser's fcrontab
2023-02-21 14:21:08 ERROR Could not open new.fcronuser.tmp: Permission denied
2023-02-21 14:21:08 ERROR Since fcrontab has not been able to save new.fcronuser's file, it will keep the previous version (if any) of new.fcronuser.

Listing fcronuser’s crontab shows the entries, but they are not executed (yes, the format is correct). Testing them from command line works fine (I created a homedir and assigned bash to fcronuser), so I think it’s something to do with the above errors.

Any ideas?

Luca.

The commands that you put into the fcronuser crontab should have a full path specified as often the path variable for root will not apply for fcronuser unless you define the groups it belongs to and modify its own path variable. If a command works fine from the command line but from a crontab then I find that often it will be that the path to that command is not available to the user running that command in the crontab.

I have always found it easier to always specify the full path for any command being run in a crontab.

If you get those errors when you are trying to edit the crontab then maybe the ownerships or permissions of the crontabs are incorrect.

I have the following:-

ls -hal /var/spool/cron/
total 28K
drwxrwx— 2 cron cron 4.0K Feb 21 14:58 .
drwxr-xr-x 4 root root 4.0K Oct 18 16:55 …
-rw------- 1 root root 568 Feb 21 14:58 fcronuser
-rw------- 1 root cron 450 Jan 30 2022 fcronuser.orig
-rw------- 1 root root 5.3K Feb 21 14:58 root
-rw------- 1 root cron 3.4K Oct 20 16:34 root.orig

How do these compare to what you have.

2 Likes

Yes, all command have full path, as I always do.
Permissions seem OK. I even restarted fcron, which set the permissions and owner showed below, but the error persists (and now fcronuser stays empty or disappears entirely). Couldn’t find anywhere that “new.fcronuser.tmp” file, either.

For now I’ll stick to root’s crontab, but I’d like “a more permanent solution to our problems” (quoting Caiaphas from “Jesus Christ Superstar”).

# ls -la
total 24
drwxr-xr-x 2 cron cron 4096 Feb 21 16:01 .
drwxr-xr-x 4 root root 4096 Feb 20 10:19 ..
-rw------- 1 root root    0 Feb 21 16:00 fcronuser
-rw-r----- 1 cron cron  183 Feb 21 16:00 fcronuser.orig
-rw------- 1 root root 5353 Feb 21 16:01 root
-rw------- 1 root cron 3558 Feb 21 14:29 root.orig

there was a typo in the wiki page (which I just corrected), the allow directive should go to

/etc/fcron.allow

and not

/etc/fcron./allow

I tested the entire procedure myself and I did not have any problem. Would you mind to check again if you correctly followed all the steps highlighted in that page?

EDIT: my apologies for the typo, I completely missed it when I prepared the wiki page.

2 Likes

Didn’t even spot that typo: I simply edited /etc/fcron.allow.

I’m pretty sure I followed everything, but I’ll erase everything and retry.