Fcrontab not working

Hello,

i made 2 cronjobs in fcrontab -e. According to the Tutorial 1 and Tutorial 2.

But i realised it is not doing what it is supposed to do. The log for “cron” in the webmenu is empty.

i tried frontrab -e with:

45 23 * * * bash /root/asn_ipfire.sh --add "Google,Facebook,Twitter,Oracle,Acxiom" > /dev/null 2>&1

and
45 23 * * * bash /root/asn_ipfire.sh --add "Google,Facebook,Twitter,Oracle,Acxiom"

none seems to work. Same with the

30 23 * * * bash /root/dns_blocklist.sh -s 1,2,3,5,7,8,12,13,14,"https://easylist.to/easylistgermany/easylistgermany.txt","https://easylist.to/easylist/easyprivacy.txt","https://easylist.to/easylist/fanboy-social.txt","https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/win7/extra.txt","https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/win7/spy.txt","https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt","https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt","https://raw.githubusercontent.com/AdguardTeam/AdguardFilters/master/MobileFilter/sections/adservers.txt","https://raw.githubusercontent.com/AdguardTeam/AdguardFilters/master/MobileFilter/sections/spyware.txt" -b /root/blacklist.hosts -r 0.0.0.0

Do you have any idea what the problem might be? If i manually bash the commands it is working just fine.

Thanks

its hard to say, but i would check if its a permission issue in /var/log/syslog or wherever the log file is.

either way, you need to look to see if Fcron is throwing an error.

The tutorials those links go to are 7 years old so they may or may not work with IPFire from today.

The logging from fcron is turned off otherwise the logs would be swamped with logging from every fcrontab entry that is executed.

However you can turn logging on for troubleshooting. See this wiki link on how to turn logging on for fcron, also how to put it in debug mode if the logging info is insufficient.

https://www.ipfire.org/docs/pkgs/fcron#troubleshooting

Then you can see what the messages are telling you about the problem with those fcron entries and based on that you can figure out what needs fixing.

2 Likes

very intersting, Thank you for the link.

The log says

15:27:00	fcron[16102]: 	Job '* bash /root/dns_blocklist.sh -s 1,2,3,5,7,8,12,13,14,"https://easylist.to/ easylistgermany/easylistgermany.txt","https://easylist.to/easylist/easyprivacy.t x (truncated)

15:27:00	fcron[16100]: 	Job '* bash /root/asn_ipfire.sh --add "Amazon,Nvidia,Google,Facebook,Twitter,Ora cle,Acxiom"' terminated (exit status: 127)

Exit 127 means that bash could not find the command it was being told to use.

I notice that you have entered the raw bash command into fcron itself.

A better approach is to put that command into a script file, and yes it will be a script file containing another script file, but then you can test running that script and see if it works okay. If not then you can fix it till running the script and confirming that it does what it should do.
With a bash command running a script with multiple elements it may be that fcron is not treating the separate parts as one command. Having it so that fcron just has to run a simple script file means that there is no issue with where the separation between elements of a command occurs.

Then you can add the script name (with complete path specified) into the fcrontab and see if that then runs correctly. The two main reasons that a script does not run correctly with fcron or cron, not just on IPFire, is either the path of a command not being specified or permissions for the script do not apply for the root user that is used by fcron.

1 Like

Ok, Thank you very much. I’ll test it with a script.