Setting fcrontab

Following the suggestion in the post

I followed the instructions in the wiki to refine some services that I currently keep set up in Fcrontab and that are deleted in IPFire updates.
I did many trials following wiki.
I was able to create and enter the processes in fcronuser, but they do not run. Where could I have gone wrong? Any suggestions?
I send a draft of the steps I did following the wiki.
I thank you in advance.

  1. From the terminal, I typed:

useradd -r -U -d / -s /bin/false -c “carlo” fcronuser

  1. I created the file “fcronuser (with Attributes: root+root+0755)”:

/etc/sudoers.d/fcronuser

And I inserted:

fcronuser ALL=(ALL) NOPASSWD:ALL

  1. I added to the file

/etc/fcron.allow

the line

fcronuser

  1. From the terminal, I typed:

export VISUAL=nano; fcrontab -u fcronuser -e

  1. I inserted in the new fcronuser, the same lines inserted in in the previous (original IPFire) file.

  2. I tried restarting the service:

/etc/rc.d/init.d/fcron restart

and also IPFire. But the “processes are not executed”.

I just tried to install a fcronuser fcron file.
It functions!

*/5 * * * * /bin/date >>/root/tfc

writes all 5 min the date into the file.

BTW: Why do you use the fcrontab way for your problem?
@bonnietwin suggested to put the iptable commands into firewall.local
That is the right place. Each start of the firewall defines the rules, each stop deletes them.

2 Likes

I thank you for the answer. I am using fcrontab with a line similar to the one you mentioned. For now iptable I have suspended it. I need to study well how firewall.local works :blush:.
I have a doubt: I did the tests with the test version of IPFire. Will this be a problem with the test version? If my procedures are correct it seems strange to me that it does not work for me.

@reboot /usr/nomefile.sh
*/1 * * * * /usr/nomefile.sh > /dev/null

The commands that are inside nomefile.sh have nothing to do with iptable. If you want I can publish them.
With the stable version everything works, but I haven’t tried there “fcronuser”.

The commands that you put in /usr/nomefile.sh do they have the full path name defined?

The testing version of CU174 would have no effect on that procedure.

2 Likes

The attributes should be the same as the other files in that directory root:root 0640

Not sure that will be related to your problems but you have made the permissions wider than they need to be.

1 Like

You don’t need to restart fcron. If you have changed an fcrontab via the fcrontab -e command then after exiting from the editor the changes are applied to the fcrontab immediately.

2 Likes

They contain lines like this:

curl -v -u “mail@gmail.com:_-nnnnnnnnnnn” https://nomesito.com nic/update?hostname=nnnnnnnnnnnnnnn

But I have another suspicion: maybe I made a mistake in writing the processes in filename.sh in the IPFire test.
If you can assure me that the procedures listed in the first post are correct, I will try it directly on my good IPFire server and update you.

I would try first on the system you have set up the fcronuser the following command.

sudo -u fcronuser /usr/nomefile.sh

This will run the command you have put into your fcrontab as the user fcronuser and if it fails it should give some messages about what the problem is.

2 Likes

Thank you very much. I’ll do the test right away and update you as soon as I finish!!! :smiling_face: :smiling_face: :smiling_face:

In the wiki page about setting up a fcrontab user there is also a Troubleshooting section near the end that would be worth having a look at.

2 Likes

I guess my suspicion was right.
It seems to be working. I will move it to my good server. I don’t think there are any other problems!!!

sudo -u fcronuser /usr/nomefile.sh

It put me on the right track!!!